From dabbb40de602f411decb9311660a094bd7720969 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 6 Apr 2015 21:59:45 +0200 Subject: [PATCH] Fix isSmResumptionPossible() returning wrong values The cases where reversed. Change the condition for better readability. Also fix int and long handling in the computation of maxResumptionMillies. Fixes SMACK-654. --- .../java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 86dea74da..378f3299d 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 @@ -1693,8 +1693,10 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { // See if resumption time is over long current = System.currentTimeMillis(); - long maxResumptionMillies = getMaxSmResumptionTime() * 1000; - if (shutdownTimestamp + maxResumptionMillies > current) { + long maxResumptionMillies = ((long) getMaxSmResumptionTime()) * 1000; + if (current > shutdownTimestamp + maxResumptionMillies) { + // Stream resumption is *not* possible if the current timestamp is greater then the greatest timestamp where + // resumption is possible return false; } else { return true;