Author: toad
Date: 2006-09-02 21:34:28 +0000 (Sat, 02 Sep 2006)
New Revision: 10375

Modified:
   trunk/freenet/src/freenet/node/Node.java
   trunk/freenet/src/freenet/node/NodeDispatcher.java
Log:
More fixes to probe requests.
Minor fix to testnet.

Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java    2006-09-02 21:21:38 UTC (rev 
10374)
+++ trunk/freenet/src/freenet/node/Node.java    2006-09-02 21:34:28 UTC (rev 
10375)
@@ -941,15 +941,6 @@
                        }
                }

-               if(wasTestnet != testnetEnabled) {
-                       Logger.error(this, "Switched from testnet mode to 
non-testnet mode or vice versa! Regenerating pubkey, privkey, and deleting 
logs.");
-                       this.myCryptoGroup = Global.DSAgroupBigA;
-                       this.myPrivKey = new DSAPrivateKey(myCryptoGroup, 
random);
-                       this.myPubKey = new DSAPublicKey(myCryptoGroup, 
myPrivKey);
-                       
-                       
-               }
-
                // Directory for node-related files other than store

                nodeConfig.register("nodeDir", ".", sortOrder++, true, false, 
"Node directory", "Name of directory to put node-related files e.g. peers list 
in", 
@@ -982,6 +973,13 @@
                        }
                }

+               if(wasTestnet != testnetEnabled) {
+                       Logger.error(this, "Switched from testnet mode to 
non-testnet mode or vice versa! Regenerating pubkey, privkey, and deleting 
logs.");
+                       this.myCryptoGroup = Global.DSAgroupBigA;
+                       this.myPrivKey = new DSAPrivateKey(myCryptoGroup, 
random);
+                       this.myPubKey = new DSAPublicKey(myCryptoGroup, 
myPrivKey);
+               }
+
                // Then read the peers
                peers = new PeerManager(this, new File(nodeDir, 
"peers-"+portNumber).getPath());
                peers.writePeers();

Modified: trunk/freenet/src/freenet/node/NodeDispatcher.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeDispatcher.java  2006-09-02 21:21:38 UTC 
(rev 10374)
+++ trunk/freenet/src/freenet/node/NodeDispatcher.java  2006-09-02 21:34:28 UTC 
(rev 10375)
@@ -522,11 +522,22 @@
                // Update best

                for(int i=0;i<peers.length;i++) {
-                       if(!peers[i].isConnected()) continue;
+                       if(!peers[i].isConnected()) {
+                               if(logMINOR)
+                                       Logger.minor(this, "Not connected: 
"+peers[i]);
+                               continue;
+                       }
                        double loc = peers[i].getLocation().getValue();
+                       if(logMINOR) Logger.minor(this, "Location: "+loc);
                        // We are only interested in locations greater than the 
target
-                       if(loc <= (best + 2*Double.MIN_VALUE)) continue;
-                       if(loc < best) best = loc;
+                       if(loc <= (target + 2*Double.MIN_VALUE)) {
+                               if(logMINOR) Logger.minor(this, "Location is 
under target");
+                               continue;
+                       }
+                       if(loc < best) {
+                               if(logMINOR) Logger.minor(this, "New best: 
"+loc+" was "+best);
+                               best = loc;
+                       }
                }

                // Update nearest


Reply via email to