From cf1f533fff954f4be8f640838ff8d22c6e7f7202 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 12 Jun 2020 21:16:05 +0200 Subject: [PATCH] [tcp] Mark SM sync points as volatile --- .../smack/tcp/XMPPTCPConnection.java | 16 ++++++++++++++-- 1 file changed, 14 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 8faaf30d9..ded929681 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 @@ -190,10 +190,22 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { */ private String smSessionId; - private SyncPointState smResumedSyncPoint; + /** + * Represents the state of stream management resumption. + *

+ * Unlike other sync points, this sync point is marked volatile because it is also read by the reader thread. + *

+ */ + private volatile SyncPointState smResumedSyncPoint; private Failed smResumptionFailed; - private boolean smEnabledSyncPoint; + /** + * Represents the state of stream magement. + *

+ * This boolean is marked volatile as it is read by various threads, including the reader thread via {@link #isSmEnabled()}. + *

+ */ + private volatile boolean smEnabledSyncPoint; /** * The client's preferred maximum resumption time in seconds.