Update of /cvsroot/freenet/freenet/src/freenet
In directory sc8-pr-cvs1:/tmp/cvs-serv24641/src/freenet

Modified Files:
        OpenConnectionManager.java 
Log Message:
Expose a couple of attributes through getters and setters.

Index: OpenConnectionManager.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/OpenConnectionManager.java,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -r1.112 -r1.113
--- OpenConnectionManager.java  4 Oct 2003 01:16:56 -0000       1.112
+++ OpenConnectionManager.java  4 Oct 2003 08:35:02 -0000       1.113
@@ -77,7 +77,20 @@
         chs = new MultiValueTable(50, 3);
         openConns = 0;
     }
-       
+   
+       public int getMaxNodeConnections(){
+               return maxConnections; 
+       }
+       public void setMaxNodeConnections(int iNewValue){
+               maxConnections = iNewValue;
+               synchronized(lru) {
+                       lru.notifyAll();
+               }
+       }
+       public int getNumberOfOpenConnections(){
+               return lru.size();
+       }
+
        public int countPeerHandlers() {
                return peerHandlers.size();
        }
@@ -698,6 +711,15 @@
                }
         return count;
     }
+    private List getConnectionListSnapshot()
+    {
+               List lConnections = new LinkedList();
+               synchronized(lru) {
+                       for (Enumeration e = lru.elements() ; e.hasMoreElements() ;)
+                               lConnections.add(e.nextElement()); //Extract the 
ConnectionHandlers so that we can sort them if we want to
+               }
+               return lConnections;    
+    }
     
        public final int countLRUConnections() {
                return lru.size();
@@ -781,17 +803,7 @@
                int sending = 0;
                int receiving = 0;
                HashSet uniquePeers = new HashSet();
-               List lConnections = new LinkedList();
-               synchronized(lru) { 
-                       //DO NOT synchronize all of this method, only synchronize
-                       //what is necessary. Any pw.print calls might deadlock
-                       //since the NIOOS's might call this.remove()
-                       for (Enumeration e = lru.elements(); e.hasMoreElements(); ) {
-                               lConnections.add(e.nextElement()); 
-                               // Extract the ConnectionHandlers so that we can sort
-                               // them if we want to
-                       }
-               }
+               List lConnections = getConnectionListSnapshot();
                
                //Build a sorter and sort
                ConnectionHandlerComparator sorter = null;
@@ -958,10 +970,10 @@
                        totalDataReceived += ch.totalDataReceived();
                        
                        if(useOldStyle){
-                               buffer.append(sepAlignRight + ch.idleTime());
+                               buffer.append(sepAlignRight + ch.getIdleTime());
                                buffer.append(sepAlignRight + ch.runTime());
                        }else{
-                               buffer.append(sepAlignCenter + 
timeFromMillis(ch.idleTime(),true,true));
+                               buffer.append(sepAlignCenter + 
timeFromMillis(ch.getIdleTime(),true,true));
                                buffer.append(sepAlignCenter + 
timeFromMillis(ch.runTime(),true,true));
                        }
                        

_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to