do not synchronize startXmpp() and sendPacket() on the same object as this can block the ui

Daniel Gultsch created

Change summary

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

Detailed changes

src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java 🔗

@@ -441,7 +441,7 @@ public class XmppConnection implements Runnable {
 	 * Starts xmpp protocol, call after connecting to socket
 	 * @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();
 		}
@@ -643,9 +643,7 @@ public class XmppConnection implements Runnable {
 					Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": resumption failed");
 				}
 				resetStreamId();
-				if (account.getStatus() != Account.State.ONLINE) {
-					sendBindRequest();
-				}
+				sendBindRequest();
 			} else if (nextTag.isStart("iq")) {
 				processIq(nextTag);
 			} else if (nextTag.isStart("message")) {