Author: toad
Date: 2008-02-08 18:02:09 +0000 (Fri, 08 Feb 2008)
New Revision: 17702

Modified:
   trunk/freenet/src/freenet/io/comm/MessageCore.java
   trunk/freenet/src/freenet/io/comm/MessageFilter.java
Log:
Check reallyTimedOut() as well as matched and dropped connection. Paranoia 
mainly.

Modified: trunk/freenet/src/freenet/io/comm/MessageCore.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/MessageCore.java  2008-02-08 17:57:48 UTC 
(rev 17701)
+++ trunk/freenet/src/freenet/io/comm/MessageCore.java  2008-02-08 18:02:09 UTC 
(rev 17702)
@@ -450,8 +450,9 @@
                                try {
                                        // Precaution against filter getting 
matched between being added to _filters and
                                        // here - bug discovered by Mason
-                                   while(!(filter.matched() || 
(filter.droppedConnection() != null))) {
-                                               long wait = 
filter.getTimeout()-System.currentTimeMillis();
+                                       // Check reallyTimedOut() too a) for 
paranoia, b) for filters with a callback (we could conceivably waitFor() them).
+                                   while(!(filter.matched() || 
(filter.droppedConnection() != null) || (filter.reallyTimedOut(now = 
System.currentTimeMillis())))) {
+                                               long wait = 
filter.getTimeout()-now;
                                                if(wait <= 0)
                                                        break;
                                                filter.wait(wait);

Modified: trunk/freenet/src/freenet/io/comm/MessageFilter.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/MessageFilter.java        2008-02-08 
17:57:48 UTC (rev 17701)
+++ trunk/freenet/src/freenet/io/comm/MessageFilter.java        2008-02-08 
18:02:09 UTC (rev 17702)
@@ -203,7 +203,7 @@
            return _droppedConnection;
        }

-       private boolean reallyTimedOut(long time) {
+       boolean reallyTimedOut(long time) {
                if(_callback != null && _callback.shouldTimeout())
                        _timeout = -1; // timeout immediately
                return _timeout < time;


Reply via email to