[freenet-cvs] r18329 - trunk/freenet/src/freenet/io/xfer

toad at freenetproject.org toad at freenetproject.org
Tue Mar 4 13:41:56 UTC 2008


Author: toad
Date: 2008-03-04 13:41:56 +0000 (Tue, 04 Mar 2008)
New Revision: 18329

Modified:
   trunk/freenet/src/freenet/io/xfer/PacketThrottle.java
Log:
Throw when waiting and peer becomes disconnected.

Modified: trunk/freenet/src/freenet/io/xfer/PacketThrottle.java
===================================================================
--- trunk/freenet/src/freenet/io/xfer/PacketThrottle.java	2008-03-04 13:29:30 UTC (rev 18328)
+++ trunk/freenet/src/freenet/io/xfer/PacketThrottle.java	2008-03-04 13:41:56 UTC (rev 18329)
@@ -160,6 +160,7 @@
 	
 	public void sendThrottledMessage(Message msg, PeerContext peer, DoubleTokenBucket overallThrottle, int packetSize, ByteCounter ctr) throws NotConnectedException {
 		long start = System.currentTimeMillis();
+		long bootID = peer.getBootID();
 		synchronized(this) {
 			while(true) {
 				int windowSize = (int) getWindowSize();
@@ -179,6 +180,8 @@
 				} catch (InterruptedException e) {
 					// Ignore
 				}
+				if(!peer.isConnected()) throw new NotConnectedException();
+				if(bootID != peer.getBootID()) throw new NotConnectedException();
 			}
 		}
 		long waitTime = System.currentTimeMillis() - start;




More information about the cvs mailing list