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

Modified Files:
        OpenConnectionManager.java 
Log Message:
oops

Index: OpenConnectionManager.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/OpenConnectionManager.java,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- OpenConnectionManager.java  7 Sep 2003 16:18:24 -0000       1.96
+++ OpenConnectionManager.java  7 Sep 2003 18:18:44 -0000       1.97
@@ -162,7 +162,6 @@
                if (logDebug)
                Core.logger.log(this, "findFreeConnection("+id+")",
                                                new Exception("debug"), Logger.DEBUG);
-               int sendingConns = 0;
                Enumeration e = chs.getAll(id); //moved this out here --zab
                HashSet candidates = new HashSet(); //put sending() && 
!reallySending() CHs here
                                                //so that we iterate over smaller 
collections
@@ -187,21 +186,26 @@
                                        res.setCached(true);
                                        return res;
                                } else {
-                                       if(!res.reallySending())
-                                               sendingConns++;
-                                       else
+                                       if(!res.reallySending()){
                                                candidates.add(res);
-                                       if (logDebug)
-                                       Core.logger.log(this, "Skipping: "+res+": 
sending",
+                                       }
+                                       else if (logDebug)
+                                               Core.logger.log(this, "Skipping: 
"+res+": sending",
                                                                        Logger.DEBUG);
                                }
                        }
                }
-               if(sendingConns < 2) {
+               /*
+                * imho this should be 1, not 2.  by opening new connections too often
+                * you starve the trailers and other messages and end up with a 
feedback loop
+                * I'll test it locally with 1 and report the results.
+                * --zab
+                */
+               if(candidates.size() < 2) {  
                        Main.node.scheduleConnectionOpener(id);
                        // open another one
                }
-               if (sendingConns == 0) //shortcut
+               if (candidates.size() == 0) //shortcut
                        return null; //we may want to notify the user we've scheduled 
to open a new conn
                
                ConnectionHandler best = null;
@@ -222,8 +226,9 @@
                                best.setCached(true);
                                return best;
                        }
-                       return null;
                }
+               return null;
+               
     }
        
     /**

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

Reply via email to