From 93ca7bc991d1d7e06ec2864ffdc1f35e0355ccdb Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Wed, 15 Jun 2005 23:04:52 +0000 Subject: [PATCH] Improved packet timeout logic. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2501 b35dd754-fafc-0310-a699-88a17e54d16e --- source/org/jivesoftware/smack/PacketReader.java | 4 +++- source/org/jivesoftware/smack/XMPPConnection.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/org/jivesoftware/smack/PacketReader.java b/source/org/jivesoftware/smack/PacketReader.java index afab76779..93c7be5a9 100644 --- a/source/org/jivesoftware/smack/PacketReader.java +++ b/source/org/jivesoftware/smack/PacketReader.java @@ -154,7 +154,9 @@ class PacketReader { break; } connectionIDLock.wait(waitTime); - waitTime -= System.currentTimeMillis() - start; + long now = System.currentTimeMillis(); + waitTime -= now - start; + start = now; } } } diff --git a/source/org/jivesoftware/smack/XMPPConnection.java b/source/org/jivesoftware/smack/XMPPConnection.java index 7cf19b8fd..3ee9f1656 100644 --- a/source/org/jivesoftware/smack/XMPPConnection.java +++ b/source/org/jivesoftware/smack/XMPPConnection.java @@ -459,7 +459,9 @@ public class XMPPConnection { break; } roster.wait(waitTime); - waitTime -= System.currentTimeMillis() - start; + long now = System.currentTimeMillis(); + waitTime -= now - start; + start = now; } } }