Update of /cvsroot/freenet/freenet/src/freenet
In directory sc8-pr-cvs1:/tmp/cvs-serv15081/src/freenet
Modified Files:
ConnectionHandler.java Core.java MessageHandler.java
Ticker.java Version.java
Log Message:
6237:
If we close a trailer while still sending a trailer chunk, this is an error. Report it
with a stack trace. This caused the send failed, valid key errors - this will help
track down the real source.
Execute messages on states on the selector loop thread, if the message is going to run
really fast (otherwise schedule it on the ticker anyway). Currently only used by
SendFinished.
Index: ConnectionHandler.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/ConnectionHandler.java,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -r1.179 -r1.180
--- ConnectionHandler.java 11 Oct 2003 23:06:38 -0000 1.179
+++ ConnectionHandler.java 14 Oct 2003 00:43:14 -0000 1.180
@@ -1319,6 +1319,12 @@
if(logDEBUG)
logDEBUG("closeTrailer("+id+"): "+twcb, true);
synchronized(trailerSendLock) {
+ if(sendingTrailerChunk) {
+ Core.logger.log(this, "Closing trailer "+id+" on
"+this+
+ " while still sending
trailer chunk!",
+ new Exception("debug"),
+ Logger.ERROR);
+ }
if(trailerSendID == id) {
if(trailerSentBytes != trailerSendLength) {
Core.logger.log(this, "Called closeTrailer,
when only sent "+
Index: Core.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/Core.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- Core.java 4 Oct 2003 01:16:55 -0000 1.43
+++ Core.java 14 Oct 2003 00:43:14 -0000 1.44
@@ -633,6 +633,16 @@
}
/**
+ * Run the MO if it can be done quickly, or schedule it on the ticker
+ * @param runNowIfFast if true, run the message immediately if it will
+ * run quickly.
+ */
+ public final void schedule(MessageObject mo, boolean runNowIfFast) {
+ if(timer == null) throw new CoreException("Core not begun");
+ timer.addNowOrRun(mo);
+ }
+
+ /**
* Schedule the MO to run on the ticker after a delay.
*/
public final void schedule(long millis, MessageObject mo) {
Index: MessageHandler.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/MessageHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MessageHandler.java 23 Jul 2002 04:51:17 -0000 1.4
+++ MessageHandler.java 14 Oct 2003 00:43:14 -0000 1.5
@@ -120,8 +120,12 @@
/**
* Handles a MessageObject.
* @param m The MessageObject to handle.
+ * @param onlyIfCanRunFast If true, only handle the message if we can do
+ * it quickly. If false, just run it now regardless.
+ * @return true, unless onlyIfCanRunFast is true and we can't run the
+ * message yet.
*/
- public abstract void handle(MessageObject m);
+ public abstract boolean handle(MessageObject m, boolean onlyIfCanRunFast);
/**
* A debug method that prints information known about the MessageObject
Index: Ticker.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/Ticker.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Ticker.java 18 Sep 2003 17:48:04 -0000 1.20
+++ Ticker.java 14 Oct 2003 00:43:14 -0000 1.21
@@ -81,7 +81,20 @@
}
addAbs(time + System.currentTimeMillis(), mo);
}
-
+
+ /**
+ * Run the event immediately if possible (@see StandardMessageHandler.handle)
+ * Otherwise add(now, mo)
+ */
+ public final void addNowOrRun(MessageObject mo) {
+ try {
+ if(!mh.handle(mo, true)) add(0, mo);
+ } catch (Throwable t) {
+ Core.logger.log(this, "Caught "+t+" handling "+mo+
+ " in Ticker.addNowOrRun",
Logger.ERROR);
+ }
+ }
+
/**
* Like add(), but the time is given as an absolute in milliseconds
* of the epoch (System.currentTimeMillis() format).
@@ -281,9 +294,8 @@
+ " at "+ now + " for
"+time,
Logger.DEBUG);
try {
- mh.handle(mo);
- }
- catch (RuntimeException e) {
+ mh.handle(mo, false);
+ } catch (RuntimeException e) {
Core.logger.log(mh, "Unhandled throw in message handling",
e, Logger.ERROR);
throw e;
Index: Version.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/Version.java,v
retrieving revision 1.429
retrieving revision 1.430
diff -u -r1.429 -r1.430
--- Version.java 13 Oct 2003 15:43:11 -0000 1.429
+++ Version.java 14 Oct 2003 00:43:14 -0000 1.430
@@ -18,7 +18,7 @@
public static String protocolVersion = "1.46";
/** The build number of the current revision */
- public static final int buildNumber = 6236;
+ public static final int buildNumber = 6237;
// 6028: may 3; ARK retrieval fix
public static final int ignoreBuildsAfter = 6500;
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs