mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 14:22:05 +01:00
Merge pull request #185 from mityada/sm-resumption-race-condition
Prevent race condition after stream resumption
This commit is contained in:
commit
853324a998
1 changed files with 3 additions and 2 deletions
|
@ -1155,8 +1155,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
if (!smSessionId.equals(resumed.getPrevId())) {
|
if (!smSessionId.equals(resumed.getPrevId())) {
|
||||||
throw new StreamIdDoesNotMatchException(smSessionId, resumed.getPrevId());
|
throw new StreamIdDoesNotMatchException(smSessionId, resumed.getPrevId());
|
||||||
}
|
}
|
||||||
// Mark SM as enabled and resumption as successful.
|
// Mark SM as enabled
|
||||||
smResumedSyncPoint.reportSuccess();
|
|
||||||
smEnabledSyncPoint.reportSuccess();
|
smEnabledSyncPoint.reportSuccess();
|
||||||
// First, drop the stanzas already handled by the server
|
// First, drop the stanzas already handled by the server
|
||||||
processHandledCount(resumed.getHandledCount());
|
processHandledCount(resumed.getHandledCount());
|
||||||
|
@ -1172,6 +1171,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
if (!stanzasToResend.isEmpty()) {
|
if (!stanzasToResend.isEmpty()) {
|
||||||
requestSmAcknowledgementInternal();
|
requestSmAcknowledgementInternal();
|
||||||
}
|
}
|
||||||
|
// Mark SM resumption as successful
|
||||||
|
smResumedSyncPoint.reportSuccess();
|
||||||
LOGGER.fine("Stream Management (XEP-198): Stream resumed");
|
LOGGER.fine("Stream Management (XEP-198): Stream resumed");
|
||||||
break;
|
break;
|
||||||
case AckAnswer.ELEMENT:
|
case AckAnswer.ELEMENT:
|
||||||
|
|
Loading…
Reference in a new issue