From 069e7d7e603ee7876a0654434aaec984ac195e0c Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 23 Apr 2014 09:49:05 +0200 Subject: [PATCH] Use connection specific reply timeout value instead of the global default one. --- .../java/org/jivesoftware/smack/XMPPBOSHConnection.java | 2 +- .../main/java/org/jivesoftware/smack/XMPPConnection.java | 2 +- .../smackx/offline/OfflineMessageManager.java | 9 ++------- .../java/org/jivesoftware/smack/XMPPTCPConnection.java | 2 +- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/bosh/src/main/java/org/jivesoftware/smack/XMPPBOSHConnection.java b/bosh/src/main/java/org/jivesoftware/smack/XMPPBOSHConnection.java index dca6246da..680840405 100644 --- a/bosh/src/main/java/org/jivesoftware/smack/XMPPBOSHConnection.java +++ b/bosh/src/main/java/org/jivesoftware/smack/XMPPBOSHConnection.java @@ -187,7 +187,7 @@ public class XMPPBOSHConnection extends XMPPConnection { synchronized (this) { if (!connected) { try { - wait(SmackConfiguration.getDefaultPacketReplyTimeout()*6); + wait(getPacketReplyTimeout()); } catch (InterruptedException e) {} } diff --git a/core/src/main/java/org/jivesoftware/smack/XMPPConnection.java b/core/src/main/java/org/jivesoftware/smack/XMPPConnection.java index 6b92d70f3..49a6b1baa 100644 --- a/core/src/main/java/org/jivesoftware/smack/XMPPConnection.java +++ b/core/src/main/java/org/jivesoftware/smack/XMPPConnection.java @@ -489,7 +489,7 @@ public abstract class XMPPConnection { if (!roster.rosterInitialized && config.isRosterLoadedAtLogin()) { try { synchronized (roster) { - long waitTime = SmackConfiguration.getDefaultPacketReplyTimeout(); + long waitTime = getPacketReplyTimeout(); long start = System.currentTimeMillis(); while (!roster.rosterInitialized) { if (waitTime <= 0) { diff --git a/extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java b/extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java index 78310fdef..8c7bfb75d 100644 --- a/extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java +++ b/extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java @@ -18,7 +18,6 @@ package org.jivesoftware.smackx.offline; import org.jivesoftware.smack.PacketCollector; -import org.jivesoftware.smack.SmackConfiguration; import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; @@ -162,9 +161,7 @@ public class OfflineMessageManager { Message message = (Message) messageCollector.nextResult(); while (message != null) { messages.add(message); - message = - (Message) messageCollector.nextResult( - SmackConfiguration.getDefaultPacketReplyTimeout()); + message = (Message) messageCollector.nextResult(); } // Stop queuing offline messages messageCollector.cancel(); @@ -193,9 +190,7 @@ public class OfflineMessageManager { Message message = (Message) messageCollector.nextResult(); while (message != null) { messages.add(message); - message = - (Message) messageCollector.nextResult( - SmackConfiguration.getDefaultPacketReplyTimeout()); + message = (Message) messageCollector.nextResult(); } // Stop queuing offline messages messageCollector.cancel(); diff --git a/tcp/src/main/java/org/jivesoftware/smack/XMPPTCPConnection.java b/tcp/src/main/java/org/jivesoftware/smack/XMPPTCPConnection.java index e6c0123df..11eaaae09 100644 --- a/tcp/src/main/java/org/jivesoftware/smack/XMPPTCPConnection.java +++ b/tcp/src/main/java/org/jivesoftware/smack/XMPPTCPConnection.java @@ -793,7 +793,7 @@ public class XMPPTCPConnection extends XMPPConnection { // Wait until compression is being used or a timeout happened synchronized (this) { try { - this.wait(SmackConfiguration.getDefaultPacketReplyTimeout() * 5); + wait(getPacketReplyTimeout()); } catch (InterruptedException e) { // Ignore.