From 2fc216bfc40d619cc04068638f993b0cdd028b6b Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 21 Jul 2017 08:30:16 +0200 Subject: [PATCH] skip initial socket closing if thread was already interrupted --- .../java/eu/siacs/conversations/xmpp/XmppConnection.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 0d0e64289..22334bc54 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -495,7 +495,13 @@ public class XmppConnection implements Runnable { @Override public void run() { - forceCloseSocket(); + synchronized (this) { + if (Thread.currentThread().isInterrupted()) { + Log.d(Config.LOGTAG,account.getJid().toBareJid()+": aborting connect because thread was interrupted"); + return; + } + forceCloseSocket(); + } connect(); }