Author: toad
Date: 2007-12-14 00:06:20 +0000 (Fri, 14 Dec 2007)
New Revision: 16521

Modified:
   trunk/freenet/src/freenet/node/NodeIPDetector.java
Log:
Fix infinite recursion

Modified: trunk/freenet/src/freenet/node/NodeIPDetector.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeIPDetector.java  2007-12-13 23:58:41 UTC 
(rev 16520)
+++ trunk/freenet/src/freenet/node/NodeIPDetector.java  2007-12-14 00:06:20 UTC 
(rev 16521)
@@ -103,11 +103,18 @@
                }

                if(node.clientCore != null) {
-                       if (addedValidIP) {
-                               onAddedValidIP();
-                       } else {
-                               onNotAddedValidIP();
+                       boolean hadValidIP;
+                       synchronized(this) {
+                               hadValidIP = hasValidIP;
+                               hasValidIP = addedValidIP;
                        }
+                       if(hadValidIP != addedValidIP) {
+                               if (addedValidIP) {
+                                       onAddedValidIP();
+                               } else {
+                                       onNotAddedValidIP();
+                               }
+                       }
                }
                synchronized(this) {
                        hasValidIP = addedValidIP;
@@ -117,7 +124,6 @@
        }

        boolean hasValidIP() {
-               FreenetInetAddress[] addrs = detectPrimaryIPAddress();
                synchronized(this) {
                        return hasValidIP;
                }


Reply via email to