diff options
author | Damian Minkov <damencho@jitsi.org> | 2010-06-14 09:59:49 +0000 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2010-06-14 09:59:49 +0000 |
commit | 1d107272cec4fbfca0c23307b00d4bff64dade29 (patch) | |
tree | 83e3e2fbd53496acc0515a42203d36ac374a5517 /src/net/java/sip/communicator/impl/netaddr | |
parent | 7ebed9c6a99d660b0acf01767ea4faef74c89d9f (diff) | |
download | jitsi-1d107272cec4fbfca0c23307b00d4bff64dade29.zip jitsi-1d107272cec4fbfca0c23307b00d4bff64dade29.tar.gz jitsi-1d107272cec4fbfca0c23307b00d4bff64dade29.tar.bz2 |
Add standby detection and handling in reconnect plugin. Fix some more root group contacts handling in SIP protocol.
Diffstat (limited to 'src/net/java/sip/communicator/impl/netaddr')
-rw-r--r-- | src/net/java/sip/communicator/impl/netaddr/NetworkConfigurationWatcher.java | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/net/java/sip/communicator/impl/netaddr/NetworkConfigurationWatcher.java b/src/net/java/sip/communicator/impl/netaddr/NetworkConfigurationWatcher.java index d071fc8..fcd08d3 100644 --- a/src/net/java/sip/communicator/impl/netaddr/NetworkConfigurationWatcher.java +++ b/src/net/java/sip/communicator/impl/netaddr/NetworkConfigurationWatcher.java @@ -91,8 +91,42 @@ public class NetworkConfigurationWatcher { long curr = System.currentTimeMillis(); + // if time spent between checks is more than 2 times + // longer than the check interval we consider it as a + // new check after standby if(!isAfterStandby && last != 0) - isAfterStandby = (last + CHECK_INTERVAL + 100 - curr) < 0; + isAfterStandby = (last + 2*CHECK_INTERVAL - curr) < 0; + + if(isAfterStandby) + { + // oo standby lets fire down to all interfaces + // so they can reconnect + Iterator<NetworkInterface> iter = activeInterfaces.iterator(); + while (iter.hasNext()) + { + NetworkInterface niface = iter.next(); + fireChangeEvent(new ChangeEvent(niface, + ChangeEvent.IFACE_DOWN, isAfterStandby)); + } + activeInterfaces.clear(); + + // we have fired events for standby, make it to false now + // so we can calculate it again next time + isAfterStandby = false; + + last = curr; + + // give time to interfaces + synchronized(this) + { + try{ + wait(CHECK_INTERVAL); + } + catch (Exception e){} + } + + continue; + } try { |