Author: toad
Date: 2008-01-31 23:26:35 +0000 (Thu, 31 Jan 2008)
New Revision: 17454

Modified:
   trunk/freenet/src/freenet/node/IPDetectorPluginManager.java
Log:
Refactor: delete maybeUrgent

Modified: trunk/freenet/src/freenet/node/IPDetectorPluginManager.java
===================================================================
--- trunk/freenet/src/freenet/node/IPDetectorPluginManager.java 2008-01-31 
23:25:18 UTC (rev 17453)
+++ trunk/freenet/src/freenet/node/IPDetectorPluginManager.java 2008-01-31 
23:26:35 UTC (rev 17454)
@@ -339,8 +339,6 @@

                boolean detect = false;

-               boolean maybeUrgent = false;
-               
                // If we have no connections, and several disconnected but 
enabled 
                // peers, then run a detection.

@@ -378,23 +376,7 @@

                // If we have no connections, and several disconnected nodes, 
we should do a
                // detection soon.
-               if(realConnections == 0 && realDisconnected > 0)
-                       maybeUrgent = true;
-               
-               // If we have no connections, and have lost several connections 
recently, we should 
-               // do a detection soon, regardless of the 1 detection per hour 
throttle.
-               if(realConnections == 0 && realDisconnected > 0 && 
recentlyConnected > 2) {
-                       if(now - lastDetectAttemptEndedTime > 6 * 60 * 1000) {
-                               return true;
-                       }
-               }
-               
-               // If it appears to be an SNAT, do a detection at least once to 
verify that, and to
-               // check whether our IP is bogus.
-               if(detector.maybeSymmetric && lastDetectAttemptEndedTime <= 0)
-                       return true;
-               
-               if(maybeUrgent) {
+               if(realConnections == 0 && realDisconnected > 0) {
                        if(firstTimeUrgent <= 0)
                                firstTimeUrgent = now;

@@ -418,6 +400,19 @@
                        firstTimeUrgent = 0;
                }

+               // If we have no connections, and have lost several connections 
recently, we should 
+               // do a detection soon, regardless of the 1 detection per hour 
throttle.
+               if(realConnections == 0 && realDisconnected > 0 && 
recentlyConnected > 2) {
+                       if(now - lastDetectAttemptEndedTime > 6 * 60 * 1000) {
+                               return true;
+                       }
+               }
+               
+               // If it appears to be an SNAT, do a detection at least once to 
verify that, and to
+               // check whether our IP is bogus.
+               if(detector.maybeSymmetric && lastDetectAttemptEndedTime <= 0)
+                       return true;
+               
                // Do the possibly-fake-IPs detection.
                // If we have one or two peers connected now, reporting real 
IPs, and 
                // if there is a locally detected address and they are 
different to it, 


Reply via email to