mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +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:
parent
129f0a0bd2
commit
41dad8658a
6 changed files with 139 additions and 32 deletions
|
@ -69,6 +69,16 @@ import java.util.*;
|
|||
*/
|
||||
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 String room;
|
||||
private String nickname = null;
|
||||
|
@ -151,7 +161,7 @@ public class GroupChat {
|
|||
* nickname.
|
||||
*/
|
||||
public synchronized void join(String nickname) throws XMPPException {
|
||||
join(nickname, 5000);
|
||||
join(nickname, REPLY_TIMEOUT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,8 +196,8 @@ public class GroupChat {
|
|||
PacketCollector response = connection.createPacketCollector(responseFilter);
|
||||
// Send join packet.
|
||||
connection.sendPacket(joinPresence);
|
||||
// Wait up to five seconds for a reply.
|
||||
Presence presence = (Presence)response.nextResult(5000);
|
||||
// Wait up to a certain number of seconds for a reply.
|
||||
Presence presence = (Presence)response.nextResult(timeout);
|
||||
if (presence == null) {
|
||||
throw new XMPPException("No response from server.");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue