Author: toad
Date: 2007-08-22 23:15:49 +0000 (Wed, 22 Aug 2007)
New Revision: 14847

Modified:
   trunk/freenet/src/freenet/node/LocationManager.java
Log:
Tidier: 1 in SWAP_RESET on both incoming and outgoing. Double the value to make 
it the same as before.

Modified: trunk/freenet/src/freenet/node/LocationManager.java
===================================================================
--- trunk/freenet/src/freenet/node/LocationManager.java 2007-08-22 23:03:34 UTC 
(rev 14846)
+++ trunk/freenet/src/freenet/node/LocationManager.java 2007-08-22 23:15:49 UTC 
(rev 14847)
@@ -50,9 +50,8 @@

     static final int TIMEOUT = 60*1000;
     static final int SWAP_MAX_HTL = 10;
-    /** Number of swap evaluations between resetting our location. Since we do 
it on both incoming and
-     * outgoing swaps, the probability is 1 in 2*SWAP_MAX_HTL on each. */
-    static final int SWAP_RESET = 1000;
+    /** Number of swap evaluations, either incoming or outgoing, between 
resetting our location. */
+    static final int SWAP_RESET = 2000;
     private static boolean logMINOR;
     final RandomSource r;
     final SwapRequestSender sender;
@@ -353,7 +352,7 @@
                 noSwaps++;
             }
             // Randomise our location every 2*SWAP_RESET swap attempts, 
whichever way it went.
-            if(node.random.nextInt(2*SWAP_RESET) == 0) {
+            if(node.random.nextInt(SWAP_RESET) == 0) {
                 setLocation(node.random.nextDouble());
                 announceLocChange();
                 node.writeNodeFile();
@@ -541,7 +540,7 @@
                 }

                 // Randomise our location every 2*SWAP_RESET swap attempts, 
whichever way it went.
-                if(node.random.nextInt(2*SWAP_RESET) == 0) {
+                if(node.random.nextInt(SWAP_RESET) == 0) {
                     setLocation(node.random.nextDouble());
                     announceLocChange();
                     node.writeNodeFile();


Reply via email to