1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 03:52:06 +01:00

Report illegal Stream Management state

Fixes SMACK-721.
This commit is contained in:
Florian Schmaus 2016-05-22 12:02:12 +02:00
parent f4ce4b6e77
commit b7211d5d67

View file

@ -47,6 +47,9 @@ public class SMUtils {
* @return the delta * @return the delta
*/ */
public static long calculateDelta(long reportedHandledCount, long lastKnownHandledCount) { public static long calculateDelta(long reportedHandledCount, long lastKnownHandledCount) {
if (lastKnownHandledCount > reportedHandledCount) {
throw new IllegalStateException("Illegal Stream Management State: Last known handled count (" + lastKnownHandledCount + ") is greater than reported handled count (" + reportedHandledCount + ')');
}
return (reportedHandledCount - lastKnownHandledCount) & MASK_32_BIT; return (reportedHandledCount - lastKnownHandledCount) & MASK_32_BIT;
} }
} }