1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 18:59:41 +02:00

Allows reply timeout to be set

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2189 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2003-12-20 12:20:30 +00:00 committed by gdombiak
parent 129f0a0bd2
commit 41dad8658a
6 changed files with 139 additions and 32 deletions

View file

@ -93,6 +93,16 @@ public class XMPPConnection {
*/
public static boolean DEBUG_ENABLED = false;
/**
* Value that indicates the number of milliseconds to wait for a response from
* the server.
*
* The reply timeout value can be assigned by setting this field to the required
* timeout, or by modifying the smack.configuration file that holds the default value
* to use.
*/
public static int REPLY_TIMEOUT = 5000;
private static List connectionEstablishedListeners = new ArrayList();
static {
// Use try block since we may not have permission to get a system
@ -269,8 +279,8 @@ public class XMPPConnection {
packetReader.createPacketCollector(new PacketIDFilter(discoveryAuth.getPacketID()));
// Send the packet
packetWriter.sendPacket(discoveryAuth);
// Wait up to five seconds for a response from the server.
IQ response = (IQ) collector.nextResult(5000);
// Wait up to a certain number of seconds for a response from the server.
IQ response = (IQ) collector.nextResult(REPLY_TIMEOUT);
if (response == null) {
throw new XMPPException("No response from the server.");
}
@ -302,8 +312,8 @@ public class XMPPConnection {
collector = packetReader.createPacketCollector(new PacketIDFilter(auth.getPacketID()));
// Send the packet.
packetWriter.sendPacket(auth);
// Wait up to five seconds for a response from the server.
response = (IQ) collector.nextResult(5000);
// Wait up to a certain number of seconds for a response from the server.
response = (IQ) collector.nextResult(REPLY_TIMEOUT);
if (response == null) {
throw new XMPPException("Authentication failed.");
}
@ -366,8 +376,8 @@ public class XMPPConnection {
packetReader.createPacketCollector(new PacketIDFilter(auth.getPacketID()));
// Send the packet.
packetWriter.sendPacket(auth);
// Wait up to five seconds for a response from the server.
IQ response = (IQ) collector.nextResult(5000);
// Wait up to a certain number of seconds for a response from the server.
IQ response = (IQ) collector.nextResult(REPLY_TIMEOUT);
if (response == null) {
throw new XMPPException("Anonymous login failed.");
}