From c88523b1b84e9226e524e8d9b7ef6987118cd2cd Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Wed, 17 Jul 2019 20:42:54 +0200 Subject: use helper method to close socket --- src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/main/java/de/pixart/messenger/xmpp') diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java index 9493b260d..70ae1bc1b 100644 --- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java @@ -1567,15 +1567,8 @@ public class XmppConnection implements Runnable { } private void forceCloseSocket() { - if (socket != null) { - try { - socket.close(); - } catch (Exception e) { - Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": exception " + e.getMessage() + " during force close"); - } - } else { - Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": socket was null during force close"); - } + FileBackend.close(this.socket); + FileBackend.close(this.tagReader); } public void interrupt() { @@ -1586,7 +1579,7 @@ public class XmppConnection implements Runnable { public void disconnect(final boolean force) { interrupt(); - Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": disconnecting force=" + Boolean.toString(force)); + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": disconnecting force=" + force); if (force) { forceCloseSocket(); } else { -- cgit v1.2.3