Author: zothar
Date: 2006-05-29 22:33:58 +0000 (Mon, 29 May 2006)
New Revision: 8942

Modified:
   trunk/freenet/src/freenet/node/PeerNode.java
Log:
Actually do DNS requests in new, separated DNSRequests thread's code path.  Add 
more logging (but currently generally useless).  This should help a lot of the 
connection problems of the new mandatory build.  More to come soonish.

Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java        2006-05-29 22:27:53 UTC 
(rev 8941)
+++ trunk/freenet/src/freenet/node/PeerNode.java        2006-05-29 22:33:58 UTC 
(rev 8942)
@@ -461,7 +461,7 @@
     public void maybeUpdateHandshakeIPs() {
        if(handshakeIPs != null) return;
       long now = System.currentTimeMillis();
-      if((now - lastAttemptedHandshakeIPUpdateTime) < 6*60*1000) return;  // 6 
minutes
+      if((now - lastAttemptedHandshakeIPUpdateTime) < 5*60*1000) return;  // 5 
minutes
       lastAttemptedHandshakeIPUpdateTime = now;
       Logger.normal(this, "Updating handshake IPs for peer '"+getPeer()+"' 
named '"+myName+"'");

@@ -476,9 +476,15 @@
                if(myNominalPeer.length == 0) {
                        if(detectedPeer == null) {
                                handshakeIPs = null;
+                               Logger.normal(this, "1: maybeUpdateHandshakeIPs 
got a result of: "+handshakeIPs);
                                return;
                        }
                        handshakeIPs = new Peer[] { detectedPeer };
+                       for(int i=0;i<handshakeIPs.length;i++) {
+                               // Actually do the DNS request for the member 
Peer of handshakeIPs
+                               handshakeIPs[i].getHandshakeAddress();
+                       }
+                       Logger.normal(this, "2: maybeUpdateHandshakeIPs got a 
result of: "+handshakeIPs);
                        return;
                }
        }
@@ -510,6 +516,11 @@
                p = newPeers;
        }
        handshakeIPs = p;
+       for(int i=0;i<handshakeIPs.length;i++) {
+               // Actually do the DNS request for the member Peer of 
handshakeIPs
+               handshakeIPs[i].getHandshakeAddress();
+       }
+       Logger.normal(this, "3: maybeUpdateHandshakeIPs got a result of: 
"+handshakeIPs);
        return;
     }

@@ -723,7 +734,6 @@
                        + 
node.random.nextInt(Node.RANDOMIZED_TIME_BETWEEN_HANDSHAKE_SENDS);
         }
         firstHandshake = false;
-        handshakeIPs = null;
         this.handshakeCount++;
         // Don't fetch ARKs for peers we have verified (through handshake) to 
be incompatible with us
         if(handshakeCount == MAX_HANDSHAKE_COUNT && 
!(verifiedIncompatibleOlderVersion || verifiedIncompatibleNewerVersion)) {


Reply via email to