1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-22 10:37:59 +01:00

Merge pull request #185 from mityada/sm-resumption-race-condition

Prevent race condition after stream resumption
This commit is contained in:
Florian Schmaus 2017-11-22 08:29:36 +01:00 committed by GitHub
commit 853324a998
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1155,8 +1155,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
if (!smSessionId.equals(resumed.getPrevId())) {
throw new StreamIdDoesNotMatchException(smSessionId, resumed.getPrevId());
}
// Mark SM as enabled and resumption as successful.
smResumedSyncPoint.reportSuccess();
// Mark SM as enabled
smEnabledSyncPoint.reportSuccess();
// First, drop the stanzas already handled by the server
processHandledCount(resumed.getHandledCount());
@ -1172,6 +1171,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
if (!stanzasToResend.isEmpty()) {
requestSmAcknowledgementInternal();
}
// Mark SM resumption as successful
smResumedSyncPoint.reportSuccess();
LOGGER.fine("Stream Management (XEP-198): Stream resumed");
break;
case AckAnswer.ELEMENT: