Author: toad
Date: 2007-12-01 18:45:27 +0000 (Sat, 01 Dec 2007)
New Revision: 16194
Modified:
trunk/freenet/src/freenet/node/PeerNode.java
Log:
Fix rekey logic: disconnect after the timeout after a rekey due to transferred
bytes, as well as after a scheduled rekey
Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java 2007-12-01 18:41:30 UTC
(rev 16193)
+++ trunk/freenet/src/freenet/node/PeerNode.java 2007-12-01 18:45:27 UTC
(rev 16194)
@@ -909,7 +909,11 @@
timeWhenRekeyingShouldOccur = timeLastRekeyed +
FNPPacketMangler.SESSION_KEY_REKEYING_INTERVAL;
shouldDisconnect = (timeWhenRekeyingShouldOccur +
FNPPacketMangler.MAX_SESSION_KEY_REKEYING_DELAY < now) && isRekeying;
shouldReturn = isRekeying || !isConnected;
- shouldRekey = (timeWhenRekeyingShouldOccur < now) ||
(totalBytesExchangedWithCurrentTracker >
FNPPacketMangler.AMOUNT_OF_BYTES_ALLOWED_BEFORE_WE_REKEY);
+ shouldRekey = (timeWhenRekeyingShouldOccur < now);
+ if((!shouldRekey) &&
totalBytesExchangedWithCurrentTracker >
FNPPacketMangler.AMOUNT_OF_BYTES_ALLOWED_BEFORE_WE_REKEY) {
+ shouldRekey = true;
+ timeWhenRekeyingShouldOccur = now;
+ }
}
if(shouldDisconnect) {