diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index cdbf6927f..8da5a50ce 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -176,6 +176,8 @@ public class XmppConnection implements Runnable { private volatile Thread mThread; private CountDownLatch mStreamCountDownLatch; + + public XmppConnection(final Account account, final XmppConnectionService service) { this.account = account; this.mXmppConnectionService = service; @@ -437,7 +439,7 @@ public class XmppConnection implements Runnable { * * @return true if server returns with valid xmpp, false otherwise */ - private synchronized boolean startXmpp(Socket socket) throws Exception { + private boolean startXmpp(Socket socket) throws Exception { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException(); } @@ -452,6 +454,9 @@ public class XmppConnection implements Runnable { tagWriter.beginDocument(); sendStartStream(); final Tag tag = tagReader.readTag(); + if (Thread.currentThread().isInterrupted()) { + throw new InterruptedException(); + } return tag != null && tag.isStart("stream"); }