Author: toad
Date: 2008-11-28 21:13:00 +0000 (Fri, 28 Nov 2008)
New Revision: 23965
Modified:
trunk/freenet/src/freenet/io/comm/MessageCore.java
trunk/freenet/src/freenet/io/comm/MessageFilter.java
Log:
doh - don't throw if starting wait in addAsyncFilter!
Modified: trunk/freenet/src/freenet/io/comm/MessageCore.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/MessageCore.java 2008-11-28 21:09:08 UTC
(rev 23964)
+++ trunk/freenet/src/freenet/io/comm/MessageCore.java 2008-11-28 21:13:00 UTC
(rev 23965)
@@ -298,7 +298,7 @@
Logger.error(this, "addAsyncFilter() on a filter which
is already matched: "+filter, new Exception("error"));
filter.clearMatched();
}
- filter.onStartWaiting();
+ filter.onStartWaiting(false);
if(logMINOR) Logger.minor(this, "Adding async filter "+filter+"
for "+callback);
Message ret = null;
if(filter.anyConnectionsDropped()) {
@@ -380,7 +380,7 @@
Logger.error(this, "waitFor() on a filter which is
already matched: "+filter, new Exception("error"));
filter.clearMatched();
}
- filter.onStartWaiting();
+ filter.onStartWaiting(true);
Message ret = null;
if(filter.anyConnectionsDropped()) {
filter.onDroppedConnection(filter.droppedConnection());
Modified: trunk/freenet/src/freenet/io/comm/MessageFilter.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/MessageFilter.java 2008-11-28
21:09:08 UTC (rev 23964)
+++ trunk/freenet/src/freenet/io/comm/MessageFilter.java 2008-11-28
21:13:00 UTC (rev 23965)
@@ -60,7 +60,7 @@
return new MessageFilter();
}
- void onStartWaiting() {
+ void onStartWaiting(boolean waitFor) {
synchronized(this) {
/* We cannot wait on a MessageFilter with a callback, because
onMatched() calls clearMatched()
* if we have a callback. The solution would be to:
@@ -68,7 +68,7 @@
* - On matching a message (setMessage), call the callback
immediately if not waitFor()ing.
* - If we are waitFor()ing, call the callback when we exit
waitFor() (onStopWaiting()???).
*/
- if(_callback != null)
+ if(waitFor && _callback != null)
throw new IllegalStateException("Cannot wait on a
MessageFilter with a callback!");
if(!_setTimeout)
Logger.error(this, "No timeout set on filter "+this,
new Exception("error"));
@@ -76,7 +76,7 @@
_timeout = System.currentTimeMillis() + _initialTimeout;
}
if(_or != null)
- _or.onStartWaiting();
+ _or.onStartWaiting(waitFor);
}
/**
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs