Author: nextgens
Date: 2007-03-25 13:23:43 +0000 (Sun, 25 Mar 2007)
New Revision: 12370

Modified:
   trunk/freenet/src/freenet/node/NodePinger.java
Log:
NodePinger doesn't need its own thread... it might reduce the precision a bit, 
but who cares ?

Modified: trunk/freenet/src/freenet/node/NodePinger.java
===================================================================
--- trunk/freenet/src/freenet/node/NodePinger.java      2007-03-25 13:18:44 UTC 
(rev 12369)
+++ trunk/freenet/src/freenet/node/NodePinger.java      2007-03-25 13:23:43 UTC 
(rev 12370)
@@ -26,23 +26,14 @@
        }

        void start() {
-               Logger.normal(this, "Starting NodePinger");
-               Thread t = new Thread(this, "Node pinger");
-               t.setDaemon(true);
-               t.start();
+               run();
        }

        final Node node;

        public void run() {
-               while(true) {
-                       try {
-                               Thread.sleep(200);
-                       } catch (InterruptedException e) {
-                               // Ignore
-                       }
-                       recalculateMean(node.peers.connectedPeers);
-               }
+               node.ps.queueTimedJob(this, 200);
+               recalculateMean(node.peers.connectedPeers);
        }

        /** Recalculate the mean ping time */


Reply via email to