Author: toad
Date: 2008-03-11 17:18:52 +0000 (Tue, 11 Mar 2008)
New Revision: 18464

Modified:
   trunk/freenet/src/freenet/node/PeerManager.java
Log:
getTimeFirstAnyConnections()

Modified: trunk/freenet/src/freenet/node/PeerManager.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerManager.java     2008-03-11 16:49:38 UTC 
(rev 18463)
+++ trunk/freenet/src/freenet/node/PeerManager.java     2008-03-11 17:18:52 UTC 
(rev 18464)
@@ -372,6 +372,12 @@
                return true;
        }

+       long timeFirstAnyConnections = 0;
+       
+       public long getTimeFirstAnyConnections() {
+               return timeFirstAnyConnections;
+       }
+       
     public void addConnectedPeer(PeerNode pn) {
        logMINOR = Logger.shouldLog(Logger.MINOR, this);
        if(!pn.isRealConnection()) {
@@ -382,7 +388,9 @@
                if(logMINOR) Logger.minor(this, "Not connected: "+pn);
                return;
        }
+       long now = System.currentTimeMillis();
        synchronized(this) {
+       if(timeFirstAnyConnections == 0) timeFirstAnyConnections = now;
         for(int i=0;i<connectedPeers.length;i++) {
             if(connectedPeers[i] == pn) {
                if(logMINOR) Logger.minor(this, "Already connected: "+pn);
@@ -1666,4 +1674,5 @@
                }
                return null;
        }
+       
 }


Reply via email to