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.