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
|
@ -96,6 +96,16 @@ public class Roster {
|
|||
*/
|
||||
public static final int SUBSCRIPTION_MANUAL = 2;
|
||||
|
||||
/**
|
||||
* 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 Map groups;
|
||||
private List entries;
|
||||
|
@ -237,11 +247,11 @@ public class Roster {
|
|||
}
|
||||
}
|
||||
rosterPacket.addRosterItem(item);
|
||||
// Wait up to 5 seconds for a reply from the server.
|
||||
// Wait up to a certain number of seconds for a reply from the server.
|
||||
PacketCollector collector = connection.createPacketCollector(
|
||||
new PacketIDFilter(rosterPacket.getPacketID()));
|
||||
connection.sendPacket(rosterPacket);
|
||||
IQ response = (IQ)collector.nextResult(5000);
|
||||
IQ response = (IQ)collector.nextResult(REPLY_TIMEOUT);
|
||||
if (response == null) {
|
||||
throw new XMPPException("No response from the server.");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue