Author: toad
Date: 2008-02-12 14:17:13 +0000 (Tue, 12 Feb 2008)
New Revision: 17822

Modified:
   trunk/freenet/src/freenet/node/simulator/RealNodeTest.java
Log:
Don't move on until min/avg/max ping times are all under SUB_MAX_PING_TIME.

Modified: trunk/freenet/src/freenet/node/simulator/RealNodeTest.java
===================================================================
--- trunk/freenet/src/freenet/node/simulator/RealNodeTest.java  2008-02-12 
14:11:19 UTC (rev 17821)
+++ trunk/freenet/src/freenet/node/simulator/RealNodeTest.java  2008-02-12 
14:17:13 UTC (rev 17822)
@@ -8,6 +8,7 @@
 import freenet.node.Location;
 import freenet.node.Node;
 import freenet.node.NodeInitException;
+import freenet.node.NodeStats;
 import freenet.node.PeerNode;
 import freenet.support.Logger;

@@ -133,15 +134,17 @@
                                                
Logger.minor(RealNodeTest.class, "Backed off: "+nodes[i]+" : "+countBackedOff);
                                }
                        }
-                       if(countFullyConnected == nodes.length && 
countReallyConnected == nodes.length) {
+                       double avgPingTime = totalPingTime / nodes.length;
+                       if(countFullyConnected == nodes.length && 
countReallyConnected == nodes.length && 
+                                       minPingTime < 
NodeStats.SUB_MAX_PING_TIME && maxPingTime < NodeStats.SUB_MAX_PING_TIME && 
avgPingTime < NodeStats.SUB_MAX_PING_TIME) {
                                System.err.println("All nodes fully connected");
                                Logger.normal(RealNodeTest.class, "All nodes 
fully connected");
                                System.err.println();
                                return;
                        } else {
                                long tDelta = (System.currentTimeMillis() - 
tStart)/1000;
-                               System.err.println("Waiting for nodes to be 
fully connected: "+countFullyConnected+" / "+nodes.length+" 
("+totalConnections+" / "+totalPeers+" connections total) - backed off 
"+totalBackedOff+" ping min/avg/max 
"+(int)minPingTime+"/"+(int)(totalPingTime/nodes.length)+"/"+(int)maxPingTime+" 
at "+tDelta+'s');
-                               Logger.normal(RealNodeTest.class, "Waiting for 
nodes to be fully connected: "+countFullyConnected+" / "+nodes.length+" 
("+totalConnections+" / "+totalPeers+" connections total) - backed off 
"+totalBackedOff+" ping min/avg/max 
"+(int)minPingTime+"/"+(int)(totalPingTime/nodes.length)+"/"+(int)maxPingTime+" 
at "+tDelta+'s');
+                               System.err.println("Waiting for nodes to be 
fully connected: "+countFullyConnected+" / "+nodes.length+" 
("+totalConnections+" / "+totalPeers+" connections total) - backed off 
"+totalBackedOff+" ping min/avg/max 
"+(int)minPingTime+"/"+(int)avgPingTime+"/"+(int)maxPingTime+" at "+tDelta+'s');
+                               Logger.normal(RealNodeTest.class, "Waiting for 
nodes to be fully connected: "+countFullyConnected+" / "+nodes.length+" 
("+totalConnections+" / "+totalPeers+" connections total) - backed off 
"+totalBackedOff+" ping min/avg/max 
"+(int)minPingTime+"/"+(int)avgPingTime+"/"+(int)maxPingTime+" at "+tDelta+'s');
                                Thread.sleep(1000);
                        }
                }


Reply via email to