diff options
author | 2013-09-07 19:54:51 +0700 | |
---|---|---|
committer | 2013-09-07 19:54:51 +0700 | |
commit | b86eb130ef8a1b06a34454a47738e0a8ba9b50dd (patch) | |
tree | 644cd1e9df062f9b520dc2dee316af666ca4282a /src/com/juick/jabber/ws/WSKeepAlive.java | |
parent | 265e629e5bc5ad8f9d2a8e94dce864ebe995bcef (diff) |
XMPPConnection.buildTextFrame; SocketSubscribed.sendByteBuffer, close
Diffstat (limited to 'src/com/juick/jabber/ws/WSKeepAlive.java')
-rw-r--r-- | src/com/juick/jabber/ws/WSKeepAlive.java | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/src/com/juick/jabber/ws/WSKeepAlive.java b/src/com/juick/jabber/ws/WSKeepAlive.java index 2e36b100..2deef594 100644 --- a/src/com/juick/jabber/ws/WSKeepAlive.java +++ b/src/com/juick/jabber/ws/WSKeepAlive.java @@ -73,35 +73,11 @@ public class WSKeepAlive implements Runnable { } if (inactive > 180) { - closeBytes.rewind(); - try { - s.sock.write(closeBytes); - } catch (Exception e) { - } finally { - try { - s.sock.socket().close(); - } catch (Exception ex) { - } - try { - s.sock.close(); - } catch (Exception ex) { - } - i.remove(); - } + s.sendByteBuffer(closeBytes); + s.close(); + i.remove(); } else if (inactive > 60) { - pingBytes.rewind(); - try { - s.sock.write(pingBytes); - } catch (Exception e) { - System.err.println("WSKeepAlive ping: " + e); - try { - s.sock.socket().close(); - } catch (Exception ex) { - } - try { - s.sock.close(); - } catch (Exception ex) { - } + if (!s.sendByteBuffer(pingBytes)) { i.remove(); } } |