Author: robert
Date: 2008-02-08 19:51:31 +0000 (Fri, 08 Feb 2008)
New Revision: 17714

Modified:
   trunk/freenet/src/freenet/node/NetworkIDManager.java
Log:
minor fixups and stats for simulator


Modified: trunk/freenet/src/freenet/node/NetworkIDManager.java
===================================================================
--- trunk/freenet/src/freenet/node/NetworkIDManager.java        2008-02-08 
19:09:15 UTC (rev 17713)
+++ trunk/freenet/src/freenet/node/NetworkIDManager.java        2008-02-08 
19:51:31 UTC (rev 17714)
@@ -33,7 +33,7 @@
        //Intervals between connectivity checks and NetworkID reckoning.
        //Checks for added peers may be delayed up to LONG_PERIOD, so don't 
make it too long.
        private static final long BETWEEN_PEERS =   2000;
-       private static final long STARTUP_DELAY =  30000;
+       private static final long STARTUP_DELAY =  20000;
        private static final long LONG_PERIOD   = 120000;

        private final short MAX_HTL;
@@ -61,6 +61,7 @@
                                public void run() {
                                        checkAllPeers();
                                        startupChecks = 
node.peers.quickCountConnectedPeers();
+                                       Logger.normal(NetworkIDManager.this, 
"Past startup delay, "+startupChecks+" connected peers");
                                        reschedule(0);
                                }
                        }, STARTUP_DELAY);
@@ -396,7 +397,7 @@
        private boolean processingRace;

        private void reschedule(long period) {
-               node.getTicker().queueTimedJob(this, LONG_PERIOD);
+               node.getTicker().queueTimedJob(this, period);
        }

        public void run() {
@@ -434,6 +435,7 @@
                                processing=null;
                                forgetPingRecords(target);
                        }
+                       processing=null;
                }
                if (startupChecks>0)
                        startupChecks--;
@@ -453,6 +455,9 @@
                }
        }

+       public long secretPingSuccesses;
+       public long totalSecretPingAttempts;
+       
        // Best effort ping from next to target, if anything out of the 
ordinary happens, it counts as a failure.
        private void blockingUpdatePingRecord(PeerNode target, PeerNode next) {
                //make a secret & uid
@@ -465,6 +470,8 @@
                boolean success=false;
                int suppliedCounter=1;

+               totalSecretPingAttempts++;
+               
                try {
                        //store secret in target
                        target.sendSync(DMT.createFNPStoreSecret(uid, secret), 
null);
@@ -503,10 +510,12 @@
                } catch (DisconnectedException e) {
                        Logger.normal(this, "one party left during connectivity 
test: "+e);
                } finally {
-                       if (success)
+                       if (success) {
+                               secretPingSuccesses++;
                                record.success(suppliedCounter, htl, dawn);
-                       else
+                       } else {
                                record.failure(suppliedCounter, htl, dawn);
+                       }
                }
        }

@@ -582,5 +591,5 @@
        }

        //or zero if we don't know yet
-       private int ourNetworkId = NO_NETWORKID;
+       public int ourNetworkId = NO_NETWORKID;
 }
\ No newline at end of file


Reply via email to