diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-08-30 20:54:41 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-08-30 20:54:41 +0200 |
commit | 266329ddc4a946c048ab49a6104133c789c7d5ae (patch) | |
tree | d566441d4a5460fa934c01edebcea25890eaa347 /src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | |
parent | 8b4e383d0f85586d57fa96bc8a6802c1ff2e455e (diff) |
use volatile for thread object in XmppConnection
Diffstat (limited to 'src/main/java/de/pixart/messenger/xmpp/XmppConnection.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java index 7373291fd..f33817f09 100644 --- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java @@ -183,13 +183,12 @@ public class XmppConnection implements Runnable { private SaslMechanism saslMechanism; private URL redirectionUrl = null; private String verifiedHostname = null; - private Thread mThread; + private volatile Thread mThread; private CountDownLatch mStreamCountDownLatch; public XmppConnection(final Account account, final XmppConnectionService service) { this.account = account; - final String tag = account.getJid().asBareJid().toString(); - mXmppConnectionService = service; + this.mXmppConnectionService = service; } private static void fixResource(Context context, Account account) { @@ -467,7 +466,7 @@ public class XmppConnection implements Runnable { * * @return true if server returns with valid xmpp, false otherwise */ - private boolean startXmpp(Socket socket) throws Exception { + private synchronized boolean startXmpp(Socket socket) throws Exception { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException(); } @@ -514,7 +513,7 @@ public class XmppConnection implements Runnable { connect(); } - private void processStream() throws XmlPullParserException, IOException, NoSuchAlgorithmException { + private void processStream() throws XmlPullParserException, IOException { final CountDownLatch streamCountDownLatch = new CountDownLatch(1); this.mStreamCountDownLatch = streamCountDownLatch; Tag nextTag = tagReader.readTag(); |