aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/util
diff options
context:
space:
mode:
authorIngo Bauersachs <ingo@jitsi.org>2011-11-22 21:00:34 +0000
committerIngo Bauersachs <ingo@jitsi.org>2011-11-22 21:00:34 +0000
commit80c77965aa83e52bd16f70d8605d8ebe4ff3c11e (patch)
tree2a501550d1822d63899d9cabc6d6ec89638f53ce /src/net/java/sip/communicator/util
parentdaa694846d08499390dbad4affc20eb87048e44a (diff)
downloadjitsi-80c77965aa83e52bd16f70d8605d8ebe4ff3c11e.zip
jitsi-80c77965aa83e52bd16f70d8605d8ebe4ff3c11e.tar.gz
jitsi-80c77965aa83e52bd16f70d8605d8ebe4ff3c11e.tar.bz2
Reset DNS server list after network change also when the ParallelResolver is disabled
Diffstat (limited to 'src/net/java/sip/communicator/util')
-rw-r--r--src/net/java/sip/communicator/util/NetworkUtils.java23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/net/java/sip/communicator/util/NetworkUtils.java b/src/net/java/sip/communicator/util/NetworkUtils.java
index 76fd6c2..0a2badb 100644
--- a/src/net/java/sip/communicator/util/NetworkUtils.java
+++ b/src/net/java/sip/communicator/util/NetworkUtils.java
@@ -9,6 +9,7 @@ package net.java.sip.communicator.util;
import java.beans.*;
import java.net.*;
import java.util.*;
+import java.util.concurrent.atomic.*;
import net.java.sip.communicator.service.netaddr.event.*;
import net.java.sip.communicator.util.dns.*;
@@ -133,6 +134,16 @@ public class NetworkUtils
private final static Object parallelResolverLock = new Object();
/**
+ * Initialization flag for {@link #netListener}
+ */
+ private static final AtomicBoolean netListenerAdded = new AtomicBoolean();
+
+ /**
+ * Listener for network change events to reset the DNS resolvers.
+ */
+ private static final NetworkListener netListener = new NetworkListener();
+
+ /**
* Determines whether the address is the result of windows auto configuration.
* (i.e. One that is in the 169.254.0.0 network)
* @param add the address to inspect
@@ -1140,6 +1151,12 @@ public class NetworkUtils
private static Lookup createLookup(String domain, int type)
throws TextParseException
{
+ // listens for network changes up/down so we can reset
+ // dns configuration
+ if(netListenerAdded.compareAndSet(false, true))
+ UtilActivator.getNetworkAddressManagerService()
+ .addNetworkConfigurationChangeListener(netListener);
+
Lookup lookup = new Lookup(domain, type);
if(!UtilActivator.getConfigurationService()
@@ -1197,12 +1214,6 @@ public class NetworkUtils
parallelResolver = new ParallelResolver(
new InetSocketAddress[]{resolverSockAddr});
- // listens for network changes up/down so we can reset
- // dns configuration
- UtilActivator.getNetworkAddressManagerService()
- .addNetworkConfigurationChangeListener(
- new NetworkListener());
-
//listens for changes on the parallel DNS settings
UtilActivator.getConfigurationService()
.addPropertyChangeListener(