removed synchronized in favor of another interrupted check in startXmpp()

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java | 7 ++++
1 file changed, 6 insertions(+), 1 deletion(-)

Detailed changes

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");
 	}