Update of /cvsroot/freenet/freenet/src/freenet
In directory sc8-pr-cvs1:/tmp/cvs-serv22304/src/freenet
Modified Files:
Version.java ConnectionHandler.java
TrailerWriterOutputStream.java
Log Message:
6368:
Don't forget to call TrailerWriteCallback.closed() when something breaks. We may have
been leaking trailer send states.
Implement a timeout of 5 minutes in TrailerWriterOutputStream.
Make space usage calculation more pessimistic - assume 1 block of overhead per file.
Apparently, Calendar.MONTH is 0 based but Calendar.DAY_OF_MONTH isn't. Fix.
Index: Version.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/Version.java,v
retrieving revision 1.563
retrieving revision 1.564
diff -u -w -r1.563 -r1.564
--- Version.java 28 Nov 2003 23:52:04 -0000 1.563
+++ Version.java 3 Dec 2003 15:41:16 -0000 1.564
@@ -20,7 +20,7 @@
public static String protocolVersion = "1.47";
/** The build number of the current revision */
- public static final int buildNumber = 6367;
+ public static final int buildNumber = 6368;
public static final int ignoreBuildsAfter = 6500;
Index: ConnectionHandler.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/ConnectionHandler.java,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -w -r1.212 -r1.213
--- ConnectionHandler.java 3 Dec 2003 13:41:55 -0000 1.212
+++ ConnectionHandler.java 3 Dec 2003 15:41:16 -0000 1.213
@@ -1184,13 +1184,16 @@
sendLock.notifyAll();
}
ocm.markClosed(this);
+ TrailerWriteCallback cb;
synchronized(trailerSendLock) {
isSendingTrailerChunk = false;
sendingTrailerChunkBytes = 0;
trailerSentBytes = 0;
trailerSendID = -1;
+ cb = twcb;
+ twcb = null;
}
- if(twcb != null) twcb.closed();
+ if(cb != null) cb.closed();
return; // closed conn, don't need another packet
}
} else {
@@ -2408,14 +2411,16 @@
if(logDEBUG) logDEBUG("Closed CHIS in terminate()");
link = null;
conn = null;
+ TrailerWriteCallback cb;
synchronized(trailerSendLock) {
isSendingTrailerChunk = false;
sendingTrailerChunkBytes = 0;
trailerSentBytes = 0;
trailerSendID = -1;
+ cb = twcb;
twcb = null;
}
- if(twcb != null) twcb.closed();
+ if(cb != null) cb.closed();
if(peerHandler != null) {
peerHandler.unregisterConnectionHandler(this);
} else {
Index: TrailerWriterOutputStream.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/TrailerWriterOutputStream.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -r1.3 -r1.4
--- TrailerWriterOutputStream.java 21 Oct 2003 01:52:35 -0000 1.3
+++ TrailerWriterOutputStream.java 3 Dec 2003 15:41:16 -0000 1.4
@@ -3,6 +3,8 @@
import java.io.OutputStream;
import java.io.IOException;
+import freenet.support.Logger;
+
public class TrailerWriterOutputStream extends OutputStream implements
TrailerWriteCallback {
TrailerWriter tw;
volatile boolean finishedSend = false;
@@ -37,11 +39,18 @@
ioe.initCause(e);
throw ioe;
}
+ long now = System.currentTimeMillis();
synchronized(this) {
while(!finishedSend) {
try {
this.wait(200);
} catch (InterruptedException e) {};
+ if(System.currentTimeMillis() - now >
+ 5*60*1000) {
+ Core.logger.log(this, "Trailer write took longer than 5
minutes for "+this,
+ new Exception("debug"), Logger.NORMAL);
+ throw new IOException("Trailer write took longer than 5
minutes");
+ }
}
}
if(!succeeded) throw new IOException("Trailed send failed");
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs