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 1f80523d2..334259254 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 @@ -1613,9 +1613,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { // See if resumption time is over long current = System.currentTimeMillis(); - int clientResumptionTime = smClientMaxResumptionTime > 0 ? smClientMaxResumptionTime : Integer.MAX_VALUE; - int serverResumptionTime = smServerMaxResumptimTime > 0 ? smServerMaxResumptimTime : Integer.MAX_VALUE; - long maxResumptionMillies = Math.max(clientResumptionTime, serverResumptionTime) * 1000; + long maxResumptionMillies = getMaxSmResumptionTime() * 1000; if (shutdownTimestamp + maxResumptionMillies > current) { return false; } else { @@ -1623,6 +1621,17 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { } } + /** + * Get the maximum resumption time in seconds after which a managed stream can be resumed. + * + * @return the maximum resumption time in seconds. + */ + public int getMaxSmResumptionTime() { + int clientResumptionTime = smClientMaxResumptionTime > 0 ? smClientMaxResumptionTime : Integer.MAX_VALUE; + int serverResumptionTime = smServerMaxResumptimTime > 0 ? smServerMaxResumptimTime : Integer.MAX_VALUE; + return Math.min(clientResumptionTime, serverResumptionTime); + } + private void processHandledCount(long handledCount) throws NotConnectedException { long ackedStanzasCount = SMUtils.calculateDelta(handledCount, serverHandledStanzasCount); final List ackedStanzas = new ArrayList(