1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-16 12:12:06 +01:00

The packet-reply-timeout is obtained from SmackConfiguration

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2191 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2004-01-01 23:21:49 +00:00 committed by gdombiak
parent 36cb521334
commit f7de4be1f9
3 changed files with 8 additions and 38 deletions

View file

@ -67,16 +67,6 @@ import java.util.*;
*/ */
public class AccountManager { public class AccountManager {
/**
* 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 XMPPConnection connection; private XMPPConnection connection;
private Registration info = null; private Registration info = null;
@ -217,7 +207,7 @@ public class AccountManager {
new PacketTypeFilter(IQ.class)); new PacketTypeFilter(IQ.class));
PacketCollector collector = connection.createPacketCollector(filter); PacketCollector collector = connection.createPacketCollector(filter);
connection.sendPacket(reg); connection.sendPacket(reg);
IQ result = (IQ)collector.nextResult(REPLY_TIMEOUT); IQ result = (IQ)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
if (result == null) { if (result == null) {
throw new XMPPException("No response from server."); throw new XMPPException("No response from server.");
} }
@ -244,7 +234,7 @@ public class AccountManager {
new PacketTypeFilter(IQ.class)); new PacketTypeFilter(IQ.class));
PacketCollector collector = connection.createPacketCollector(filter); PacketCollector collector = connection.createPacketCollector(filter);
connection.sendPacket(reg); connection.sendPacket(reg);
IQ result = (IQ)collector.nextResult(REPLY_TIMEOUT); IQ result = (IQ)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
if (result == null) { if (result == null) {
throw new XMPPException("No response from server."); throw new XMPPException("No response from server.");
} }
@ -276,7 +266,7 @@ public class AccountManager {
new PacketTypeFilter(IQ.class)); new PacketTypeFilter(IQ.class));
PacketCollector collector = connection.createPacketCollector(filter); PacketCollector collector = connection.createPacketCollector(filter);
connection.sendPacket(reg); connection.sendPacket(reg);
IQ result = (IQ)collector.nextResult(REPLY_TIMEOUT); IQ result = (IQ)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
if (result == null) { if (result == null) {
throw new XMPPException("No response from server."); throw new XMPPException("No response from server.");
} }
@ -297,7 +287,7 @@ public class AccountManager {
new PacketTypeFilter(IQ.class)); new PacketTypeFilter(IQ.class));
PacketCollector collector = connection.createPacketCollector(filter); PacketCollector collector = connection.createPacketCollector(filter);
connection.sendPacket(reg); connection.sendPacket(reg);
IQ result = (IQ)collector.nextResult(REPLY_TIMEOUT); IQ result = (IQ)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
if (result == null) { if (result == null) {
throw new XMPPException("No response from server."); throw new XMPPException("No response from server.");
} }

View file

@ -69,16 +69,6 @@ import java.util.*;
*/ */
public class GroupChat { public class GroupChat {
/**
* 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 XMPPConnection connection; private XMPPConnection connection;
private String room; private String room;
private String nickname = null; private String nickname = null;
@ -161,7 +151,7 @@ public class GroupChat {
* nickname. * nickname.
*/ */
public synchronized void join(String nickname) throws XMPPException { public synchronized void join(String nickname) throws XMPPException {
join(nickname, REPLY_TIMEOUT); join(nickname, SmackConfiguration.getPacketReplyTimeout());
} }
/** /**

View file

@ -93,16 +93,6 @@ public class XMPPConnection {
*/ */
public static boolean DEBUG_ENABLED = false; 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(); private static List connectionEstablishedListeners = new ArrayList();
static { static {
// Use try block since we may not have permission to get a system // Use try block since we may not have permission to get a system
@ -280,7 +270,7 @@ public class XMPPConnection {
// Send the packet // Send the packet
packetWriter.sendPacket(discoveryAuth); packetWriter.sendPacket(discoveryAuth);
// Wait up to a certain number of seconds for a response from the server. // Wait up to a certain number of seconds for a response from the server.
IQ response = (IQ) collector.nextResult(REPLY_TIMEOUT); IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
if (response == null) { if (response == null) {
throw new XMPPException("No response from the server."); throw new XMPPException("No response from the server.");
} }
@ -313,7 +303,7 @@ public class XMPPConnection {
// Send the packet. // Send the packet.
packetWriter.sendPacket(auth); packetWriter.sendPacket(auth);
// Wait up to a certain number of seconds for a response from the server. // Wait up to a certain number of seconds for a response from the server.
response = (IQ) collector.nextResult(REPLY_TIMEOUT); response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
if (response == null) { if (response == null) {
throw new XMPPException("Authentication failed."); throw new XMPPException("Authentication failed.");
} }
@ -377,7 +367,7 @@ public class XMPPConnection {
// Send the packet. // Send the packet.
packetWriter.sendPacket(auth); packetWriter.sendPacket(auth);
// Wait up to a certain number of seconds for a response from the server. // Wait up to a certain number of seconds for a response from the server.
IQ response = (IQ) collector.nextResult(REPLY_TIMEOUT); IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
if (response == null) { if (response == null) {
throw new XMPPException("Anonymous login failed."); throw new XMPPException("Anonymous login failed.");
} }