Author: toad
Date: 2008-05-07 14:26:03 +0000 (Wed, 07 May 2008)
New Revision: 19824

Modified:
   trunk/freenet/src/freenet/node/SeedServerPeerNode.java
Log:
Call maybeSendAnnouncement() 5 seconds after getting a seednode connection, not 
instantly after.
We don't want all the announcements to go to the 3 nodes which happen to 
connect fastest, that will probably lead to bad announcements, fewer nodes, 
slower overall progress of announcement.

Modified: trunk/freenet/src/freenet/node/SeedServerPeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/SeedServerPeerNode.java      2008-05-07 
14:24:43 UTC (rev 19823)
+++ trunk/freenet/src/freenet/node/SeedServerPeerNode.java      2008-05-07 
14:26:03 UTC (rev 19824)
@@ -61,12 +61,22 @@

        protected void sendInitialMessages() {
                super.sendInitialMessages();
-               OpennetManager om = node.getOpennet();
+               final OpennetManager om = node.getOpennet();
                if(om == null) {
                        Logger.normal(this, "Opennet turned off while 
connecting to seednodes");
                        node.peers.disconnect(this, true, true);
                } else {
-                       om.announcer.maybeSendAnnouncement();
+                       // Wait 5 seconds. Another node may connect first, we 
don't want all the
+                       // announcements to go to the node which we connect to 
most quickly.
+                       node.getTicker().queueTimedJob(new Runnable() {
+                               public void run() {
+                                       try {
+                                               
om.announcer.maybeSendAnnouncement();
+                                       } catch (Throwable t) {
+                                               Logger.error(this, "Caught "+t, 
t);
+                                       }
+                               }
+                       }, 5*1000);
                }
        }



Reply via email to