1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 09:39:39 +02:00

SMACK-412 Added the pingMyServer back in, cleaned up unneeded synchronization and removed minimum ping interval.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_0@13588 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
rcollier 2013-03-23 11:59:08 +00:00
parent 999c86ef4c
commit a14178990b
8 changed files with 174 additions and 42 deletions

View file

@ -57,8 +57,6 @@ import org.jivesoftware.smackx.ServiceDiscoveryManager;
* @author Florian Schmaus
*/
public class ServerPingManager {
public static final long PING_MINIMUM = 10000;
private static Map<Connection, ServerPingManager> instances = Collections
.synchronizedMap(new WeakHashMap<Connection, ServerPingManager>());
private static long defaultPingInterval = SmackConfiguration.getKeepAliveInterval();
@ -173,12 +171,15 @@ public class ServerPingManager {
* The new ping time interval in milliseconds.
*/
public void setPingInterval(long newPingInterval) {
if (newPingInterval < PING_MINIMUM)
newPingInterval = PING_MINIMUM;
if (pingInterval != newPingInterval) {
pingInterval = newPingInterval;
schedulePingServerTask();
if (pingInterval < 0) {
stopPinging();
}
else {
schedulePingServerTask();
}
}
}