From f2b44f65d938a075648bfa038d034f844e61a6d5 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sun, 14 Mar 2021 17:51:33 +0100 Subject: [PATCH] [tcp] Add code comment why we need to set "running = false" here --- .../java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 c9884a3d0..c1dc8b7ee 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 @@ -1142,7 +1142,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { } catch (Exception e) { // Set running to false since this thread will exit here and notifyConnectionError() will wait until - // the reader and writer thread's 'running' value is false. + // the reader and writer thread's 'running' value is false. Hence we need to set it to false before calling + // notifyConnetctionError() below, even though run() also sets it to false. Therefore, do not remove this. running = false; String ignoreReasonThread = null;