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

Modified Files:
        AbstractSelectorLoop.java ListenSelectorLoop.java 
        ThrottledSelectorLoop.java WriteSelectorLoop.java 
Log Message:
6172:
Change synchronization in OCM.findFreeConn to allow us to call scheduleConnOpener. Do 
it if necessary (start a conn opener and take the existing conn, if we have only 1 
message sending connection). Might cause other deadlocks, we shall see.
If we are not throttling, try write all jobs in WSL!
If we skip a throttled conn because we've already processed some, and we don't get 
backed off for throttling, use zero selector timeout.
Put a limit (1 hour) on the IOException on write backoff in FileLoggerHook.
Logging


Index: AbstractSelectorLoop.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/transport/AbstractSelectorLoop.java,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- AbstractSelectorLoop.java   30 Aug 2003 23:16:54 -0000      1.72
+++ AbstractSelectorLoop.java   5 Sep 2003 16:08:51 -0000       1.73
@@ -575,10 +575,14 @@
                        //sel.selectedKeys().clear();
                        //select on the selector
                        iter++;
+                       long now = System.currentTimeMillis();
                        if(!mySelect(timeout)) continue;
+                       long selected = System.currentTimeMillis();
+                       Core.logger.log(this, "Returned from selector in "+
+                                                       (selected-now)+" millis",
+                                                       Logger.DEBUG);
                        
                        
-                                               
 //                     Core.logger.log(this, "Returned from selector, 
"+currentlyActive+
 //                                                     " connections ("+iter+")", 
Logger.DEBUG);
                        

Index: ListenSelectorLoop.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/transport/ListenSelectorLoop.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ListenSelectorLoop.java     16 Aug 2003 16:54:15 -0000      1.17
+++ ListenSelectorLoop.java     5 Sep 2003 16:08:52 -0000       1.18
@@ -116,12 +116,13 @@
                     System.runFinalization();
                     oomSleep *= 2;
                     try {
-                        String s = "Attempted to recover from OutOfMemoryError";
+                        String s = "Attempted to recover from OutOfMemoryError "+
+                                                       e.toString();
                         freenet.Core.logger.log(this, s, 
                                                 freenet.support.Logger.ERROR);
                         System.err.println(s);
                     } catch (Throwable t) {};
-                } 
+                }
             }
         } catch (Throwable t) {
                        String s = "Caught a "+t+

Index: ThrottledSelectorLoop.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/transport/ThrottledSelectorLoop.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- ThrottledSelectorLoop.java  5 Aug 2003 16:29:21 -0000       1.21
+++ ThrottledSelectorLoop.java  5 Sep 2003 16:08:52 -0000       1.22
@@ -32,6 +32,8 @@
        
        int throttleQueueLength = 0;
        
+       protected boolean shortTimeout = false;
+       
        public final int throttleQueueLength() {
                return throttleQueueLength;
        }
@@ -110,9 +112,10 @@
                                   reregisterThrottledTime > now) {
                                        timeout = (int)(reregisterThrottledTime - now);
                                }
-                       }
+                       } else timeout = shortTimeout ? 0 : TIMEOUT;
                } else
-                       timeout = TIMEOUT;
+                       timeout = shortTimeout ? 0 : TIMEOUT;
+               shortTimeout = false;
                if(logDEBUG)
                        Core.logger.log(this, "Set timeout to "+timeout,
                                                        Logger.DEBUG);

Index: WriteSelectorLoop.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/transport/WriteSelectorLoop.java,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- WriteSelectorLoop.java      30 Aug 2003 23:16:55 -0000      1.55
+++ WriteSelectorLoop.java      5 Sep 2003 16:08:52 -0000       1.56
@@ -538,12 +538,13 @@
                                if(currentJob.destination instanceof SocketChannel &&
                                   (!((SocketChannel)(currentJob.destination)).
                                        isConnected())) throw new IOException("not 
connected");
-                               if(currentJob.client.shouldThrottle()) {
+                               if(bw != null && currentJob.client.shouldThrottle()) {
                                        if(noMoreThrottled) {
                                                // Will get cancelled by 
throttleConnections
                                                if(logDEBUG)
                                                        Core.logger.log(this, 
"Skipping (A) throttled "+
                                                                                       
 currentJob, Logger.DEBUG);
+                                               shortTimeout = true; // just in case 
the bytes are absorbed by the throttle
                                                continue;
                                        } else if(noThrottled) {
                                                // May not get cancelled by 
throttleConnections

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

Reply via email to