From 63f133e68bab8e861ea2fcc18464c50349c34dc3 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 17 Jun 2020 21:55:24 +0200 Subject: [PATCH] Set 'running' to true prior starting the reader/writer threads To ensure the thread starting the reader/writer threads sees them running and eventually waits until the 'running' boolean is reset to 'false' upon connection termination. --- .../java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java index 30785fdbc..ad86ce420 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java @@ -912,11 +912,11 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { void init() { done = false; + running = true; Async.go(new Runnable() { @Override public void run() { LOGGER.finer(threadName + " start"); - running = true; try { parsePackets(); } finally { @@ -1184,11 +1184,11 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { } queue.start(); + running = true; Async.go(new Runnable() { @Override public void run() { LOGGER.finer(threadName + " start"); - running = true; try { writePackets(); } finally {