Author: toad
Date: 2007-06-21 17:56:16 +0000 (Thu, 21 Jun 2007)
New Revision: 13692
Modified:
trunk/freenet/src/freenet/node/NodeDispatcher.java
Log:
Revert last change, document, use canReject as it was intended to be used
Modified: trunk/freenet/src/freenet/node/NodeDispatcher.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeDispatcher.java 2007-06-21 17:53:01 UTC
(rev 13691)
+++ trunk/freenet/src/freenet/node/NodeDispatcher.java 2007-06-21 17:56:16 UTC
(rev 13692)
@@ -504,7 +504,7 @@
for(int i=0;i<locsNotVisited.length;i++)
notVisitedList.add(new
Double(locsNotVisited[i]));
}
- innerHandleProbeRequest(src, id, lid, target, best, nearest,
htl, counter, true, false, null, notVisitedList, 2.0);
+ innerHandleProbeRequest(src, id, lid, target, best, nearest,
htl, counter, true, true, false, null, notVisitedList, 2.0);
return true;
}
@@ -522,13 +522,15 @@
* @param htl
* @param counter
* @param checkRecent
+ * @param canReject True if this is a new request which can be rejected
due to load, false if it's an existing
+ * request which we should handle anyway.
* @param cb
* @param locsNotVisited
* @param maxDistance
* @return
*/
private void innerHandleProbeRequest(PeerNode src, long id, Long lid,
final double target, double best,
- double nearest, short htl, short counter, boolean
checkRecent,
+ double nearest, short htl, short counter, boolean
checkRecent, boolean canReject,
boolean fromRejection, ProbeCallback cb, Vector
locsNotVisited, double maxDistance) {
if(fromRejection) {
nearest = furthestLoc(target);
@@ -543,7 +545,7 @@
synchronized(recentProbeContexts) {
if(checkRecent) {
long now = System.currentTimeMillis();
- if(now - tLastReceivedProbeRequest < 500) {
+ if(now - tLastReceivedProbeRequest < 500 &&
canReject) {
rejected = true;
} else {
tLastReceivedProbeRequest = now;
@@ -809,7 +811,7 @@
furthestDist = dist;
}
}
- innerHandleProbeRequest(src, id, lid, target,
best, nearest, ctx.htl, counter, false, false, null, notVisitedList,
furthestDist);
+ innerHandleProbeRequest(src, id, lid, target,
best, nearest, ctx.htl, counter, false, false, false, null, notVisitedList,
furthestDist);
return true;
}
}
@@ -907,7 +909,7 @@
for(int i=0;i<locsNotVisited.length;i++)
notVisitedList.add(new
Double(locsNotVisited[i]));
}
- innerHandleProbeRequest(src, id, lid, target, best, nearest,
htl, counter, false, true, null, notVisitedList, 2.0);
+ innerHandleProbeRequest(src, id, lid, target, best, nearest,
htl, counter, false, false, true, null, notVisitedList, 2.0);
return true;
}
@@ -918,7 +920,7 @@
recentProbeRequestIDs.push(ll);
}
double nodeLoc = node.getLocation();
- innerHandleProbeRequest(null, l, ll, d, (nodeLoc > d) ? nodeLoc
: furthestGreater(d), nodeLoc, node.maxHTL(), (short)0, false, false, cb, new
Vector(), 2.0);
+ innerHandleProbeRequest(null, l, ll, d, (nodeLoc > d) ? nodeLoc
: furthestGreater(d), nodeLoc, node.maxHTL(), (short)0, false, false, false,
cb, new Vector(), 2.0);
}
private double furthestLoc(double d) {