Author: toad
Date: 2008-11-28 20:06:34 +0000 (Fri, 28 Nov 2008)
New Revision: 23961
Modified:
trunk/freenet/src/freenet/io/comm/MessageFilter.java
Log:
We do not support waitFor() on a message with a callback. Document why.
Modified: trunk/freenet/src/freenet/io/comm/MessageFilter.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/MessageFilter.java 2008-11-28
20:00:34 UTC (rev 23960)
+++ trunk/freenet/src/freenet/io/comm/MessageFilter.java 2008-11-28
20:06:34 UTC (rev 23961)
@@ -62,6 +62,14 @@
void onStartWaiting() {
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:
+ * - Set a flag indicating we are waitFor()ing a filter here.
+ * - 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)
+ 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"));
if(_initialTimeout > 0 && _timeoutFromWait)
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs