Author: toad
Date: 2008-09-04 17:39:16 +0000 (Thu, 04 Sep 2008)
New Revision: 22426
Modified:
trunk/freenet/src/freenet/node/PeerNode.java
Log:
Don't grumble about a failure to match a packet if we cannot possibly have
matched it as we weren't up at the time.
Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java 2008-09-04 17:38:26 UTC
(rev 22425)
+++ trunk/freenet/src/freenet/node/PeerNode.java 2008-09-04 17:39:16 UTC
(rev 22426)
@@ -3613,8 +3613,14 @@
synchronized(this) {
if(forceDisconnectCalled)
return;
- if(now - this.timeLastConnected <
SENT_PACKETS_MAX_TIME_AFTER_CONNECT)
- return;
+ /*
+ * I've had some very strange results from seed clients!
+ * One showed deltas of over 10 minutes... how is that
possible? The PN wouldn't reconnect?!
+ */
+ if(!isRealConnection())
+ return; // The packets wouldn't have been
assigned to this PeerNode!
+// if(now - this.timeLastConnected <
SENT_PACKETS_MAX_TIME_AFTER_CONNECT)
+// return;
}
long baseTime = m.getLong(DMT.TIME);
baseTime += this.clockDelta;
@@ -3629,13 +3635,15 @@
// They are in increasing order
// Loop backwards
long otime = Long.MAX_VALUE;
- long[][] sent = getSentPacketTimesHashes();
+ long[][] sent = getRecvPacketTimesHashes();
long[] sentTimes = sent[0];
long[] sentHashes = sent[1];
short sentPtr = (short) (sent.length - 1);
short notFoundCount = 0;
short consecutiveNotFound = 0;
short longestConsecutiveNotFound = 0;
+ short ignoredUptimeCount = 0;
+ short found = 0;
//The arrays are constructed from received data, don't
throw an ArrayIndexOutOfBoundsException if they are different sizes.
int shortestArray=times.length;
if (shortestArray > packetHashes.length)
@@ -3673,17 +3681,24 @@
break;
}
if(match == -1) {
- // Not found
- consecutiveNotFound++;
- notFoundCount++;
+ long mustHaveBeenUpAt = now -
timeDeltas[i] * 2 - 5*1000;
+ if(this.crypto.socket.getStartTime() >
mustHaveBeenUpAt) {
+ ignoredUptimeCount++;
+ } else {
+ // Not found
+ consecutiveNotFound++;
+ notFoundCount++;
+ }
} else {
if(consecutiveNotFound >
longestConsecutiveNotFound)
longestConsecutiveNotFound =
consecutiveNotFound;
consecutiveNotFound = 0;
+ found++;
}
}
if(consecutiveNotFound > longestConsecutiveNotFound)
longestConsecutiveNotFound =
consecutiveNotFound;
+ Logger.error(this, "Packets: "+packetHashes.length+"
not found "+notFoundCount+" consecutive not found "+consecutiveNotFound+"
longest consecutive not found "+longestConsecutiveNotFound+" ignored due to
uptime: "+ignoredUptimeCount+" found: "+found);
if(consecutiveNotFound > TRACK_PACKETS / 2) {
manyPacketsClaimedSentNotReceived = true;
Logger.error(this, "" + consecutiveNotFound + "
consecutive packets not found on " + userToString());