From 6e6a3ef88d5d53c221fc2b8f8e9104717fa5b822 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 17 Oct 2024 18:08:31 +0200 Subject: [PATCH] [tcp] Set shutdownTimestamp before queue.shutdown() In the writer thread, we use shutdownTimestamp to determine if we should break out of the writer loop. If we set shutdownTimestamp *after* queue.shutdown(), then there is a brief period where nextStreamElement() returns 'null' but done() still returns 'true'. Hence, we switch the logic "setting" those values. --- .../main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java | 2 +- 1 file changed, 1 insertion(+), 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 8f9b8a9cb..146cfbee5 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 @@ -1305,8 +1305,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { */ void shutdown(boolean instant) { instantShutdown = instant; - queue.shutdown(); shutdownTimestamp = System.currentTimeMillis(); + queue.shutdown(); } /**