Author: toad
Date: 2008-02-19 17:21:34 +0000 (Tue, 19 Feb 2008)
New Revision: 18068
Modified:
trunk/freenet/src/freenet/io/comm/DMT.java
trunk/freenet/src/freenet/node/AnnounceSender.java
trunk/freenet/src/freenet/node/CHKInsertHandler.java
trunk/freenet/src/freenet/node/CHKInsertSender.java
trunk/freenet/src/freenet/node/Node.java
trunk/freenet/src/freenet/node/NodeClientCore.java
trunk/freenet/src/freenet/node/OpennetManager.java
trunk/freenet/src/freenet/node/RequestHandler.java
trunk/freenet/src/freenet/node/RequestSender.java
trunk/freenet/src/freenet/node/SSKInsertHandler.java
trunk/freenet/src/freenet/node/SSKInsertSender.java
Log:
Remove nearestLoc and all logic related to it.
Modified: trunk/freenet/src/freenet/io/comm/DMT.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/DMT.java 2008-02-19 16:44:14 UTC (rev
18067)
+++ trunk/freenet/src/freenet/io/comm/DMT.java 2008-02-19 17:21:34 UTC (rev
18068)
@@ -419,12 +419,12 @@
addField(FREENET_ROUTING_KEY, NodeCHK.class);
}};
- public static final Message createFNPCHKDataRequest(long id, short htl,
NodeCHK key, double nearestLocation) {
+ public static final Message createFNPCHKDataRequest(long id, short htl,
NodeCHK key) {
Message msg = new Message(FNPCHKDataRequest);
msg.set(UID, id);
msg.set(HTL, htl);
msg.set(FREENET_ROUTING_KEY, key);
- msg.set(NEAREST_LOCATION, nearestLocation);
+ msg.set(NEAREST_LOCATION, 0.0);
return msg;
}
@@ -436,12 +436,12 @@
addField(NEED_PUB_KEY, Boolean.class);
}};
- public static final Message createFNPSSKDataRequest(long id, short htl,
NodeSSK key, double nearestLocation, boolean needPubKey) {
+ public static final Message createFNPSSKDataRequest(long id, short htl,
NodeSSK key, boolean needPubKey) {
Message msg = new Message(FNPSSKDataRequest);
msg.set(UID, id);
msg.set(HTL, htl);
msg.set(FREENET_ROUTING_KEY, key);
- msg.set(NEAREST_LOCATION, nearestLocation);
+ msg.set(NEAREST_LOCATION, 0.0);
msg.set(NEED_PUB_KEY, needPubKey);
return msg;
}
@@ -534,12 +534,12 @@
addField(FREENET_ROUTING_KEY, Key.class);
}};
- public static final Message createFNPInsertRequest(long id, short htl,
Key key, double nearestLoc) {
+ public static final Message createFNPInsertRequest(long id, short htl,
Key key) {
Message msg = new Message(FNPInsertRequest);
msg.set(UID, id);
msg.set(HTL, htl);
msg.set(FREENET_ROUTING_KEY, key);
- msg.set(NEAREST_LOCATION, nearestLoc);
+ msg.set(NEAREST_LOCATION, 0.0);
return msg;
}
@@ -623,12 +623,12 @@
addField(DATA, ShortBuffer.class);
}};
- public static Message createFNPSSKInsertRequest(long uid, short htl,
NodeSSK myKey, double closestLocation, byte[] headers, byte[] data, byte[]
pubKeyHash) {
+ public static Message createFNPSSKInsertRequest(long uid, short htl,
NodeSSK myKey, byte[] headers, byte[] data, byte[] pubKeyHash) {
Message msg = new Message(FNPSSKInsertRequest);
msg.set(UID, uid);
msg.set(HTL, htl);
msg.set(FREENET_ROUTING_KEY, myKey);
- msg.set(NEAREST_LOCATION, closestLocation);
+ msg.set(NEAREST_LOCATION, 0.0);
msg.set(BLOCK_HEADERS, new ShortBuffer(headers));
msg.set(PUBKEY_HASH, new ShortBuffer(pubKeyHash));
msg.set(DATA, new ShortBuffer(data));
@@ -750,14 +750,14 @@
addField(TARGET_LOCATION, Double.class);
}};
- public static Message createFNPOpennetAnnounceRequest(long uid, long
transferUID, int noderefLength, int paddedLength, double target, short htl,
double nearestLocSoFar) {
+ public static Message createFNPOpennetAnnounceRequest(long uid, long
transferUID, int noderefLength, int paddedLength, double target, short htl) {
Message msg = new Message(FNPOpennetAnnounceRequest);
msg.set(UID, uid);
msg.set(TRANSFER_UID, transferUID);
msg.set(NODEREF_LENGTH, noderefLength);
msg.set(PADDED_LENGTH, paddedLength);
msg.set(HTL, htl);
- msg.set(NEAREST_LOCATION, nearestLocSoFar);
+ msg.set(NEAREST_LOCATION, 0.0);
msg.set(TARGET_LOCATION, target);
return msg;
}
Modified: trunk/freenet/src/freenet/node/AnnounceSender.java
===================================================================
--- trunk/freenet/src/freenet/node/AnnounceSender.java 2008-02-19 16:44:14 UTC
(rev 18067)
+++ trunk/freenet/src/freenet/node/AnnounceSender.java 2008-02-19 17:21:34 UTC
(rev 18068)
@@ -32,7 +32,6 @@
private byte[] noderefBuf;
private int noderefLength;
private short htl;
- private double nearestLoc;
private double target;
private static boolean logMINOR;
private final AnnouncementCallback cb;
@@ -46,7 +45,6 @@
this.node = node;
this.onlyNode = null;
htl = (short) Math.min(m.getShort(DMT.HTL), node.maxHTL());
- nearestLoc = m.getDouble(DMT.NEAREST_LOCATION);
target = m.getDouble(DMT.TARGET_LOCATION); // FIXME validate
logMINOR = Logger.shouldLog(Logger.MINOR, this);
cb = null;
@@ -92,15 +90,6 @@
if(!transferNoderef()) return;
}
- double myLoc = node.lm.getLocation();
- if(Location.distance(target, myLoc) < Location.distance(target,
nearestLoc)) {
- nearestLoc = myLoc;
- htl = node.maxHTL();
- } else {
- if(source != null)
- htl = node.decrementHTL(source, htl);
- }
-
// Now route it.
HashSet nodesRoutedTo = new HashSet();
@@ -391,7 +380,7 @@
*/
private long sendTo(PeerNode next) {
try {
- return om.startSendAnnouncementRequest(uid, next,
noderefBuf, this, target, htl, nearestLoc);
+ return om.startSendAnnouncementRequest(uid, next,
noderefBuf, this, target, htl);
} catch (NotConnectedException e) {
if(logMINOR) Logger.minor(this, "Disconnected");
return -1;
Modified: trunk/freenet/src/freenet/node/CHKInsertHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/CHKInsertHandler.java 2008-02-19
16:44:14 UTC (rev 18067)
+++ trunk/freenet/src/freenet/node/CHKInsertHandler.java 2008-02-19
17:21:34 UTC (rev 18068)
@@ -39,7 +39,6 @@
final PeerNode source;
final NodeCHK key;
final long startTime;
- private double closestLoc;
private short htl;
private CHKInsertSender sender;
private byte[] headers;
@@ -56,13 +55,8 @@
this.startTime = startTime;
key = (NodeCHK) req.getObject(DMT.FREENET_ROUTING_KEY);
htl = req.getShort(DMT.HTL);
- closestLoc = req.getDouble(DMT.NEAREST_LOCATION);
double targetLoc = key.toNormalizedDouble();
double myLoc = node.lm.getLocation();
- if(Location.distance(targetLoc, myLoc) < Location.distance(targetLoc,
closestLoc)) {
- closestLoc = myLoc;
- htl = node.maxHTL();
- }
logMINOR = Logger.shouldLog(Logger.MINOR, this);
receivedBytes(req.receivedByteCount());
}
@@ -144,7 +138,7 @@
prb = new PartiallyReceivedBlock(Node.PACKETS_IN_BLOCK,
Node.PACKET_SIZE);
if(htl > 0)
- sender = node.makeInsertSender(key, htl, uid, source, headers,
prb, false, closestLoc, true);
+ sender = node.makeInsertSender(key, htl, uid, source, headers,
prb, false, true);
br = new BlockReceiver(node.usm, source, uid, prb, this);
// Receive the data, off thread
Modified: trunk/freenet/src/freenet/node/CHKInsertSender.java
===================================================================
--- trunk/freenet/src/freenet/node/CHKInsertSender.java 2008-02-19 16:44:14 UTC
(rev 18067)
+++ trunk/freenet/src/freenet/node/CHKInsertSender.java 2008-02-19 17:21:34 UTC
(rev 18068)
@@ -164,7 +164,7 @@
}
CHKInsertSender(NodeCHK myKey, long uid, byte[] headers, short htl,
- PeerNode source, Node node, PartiallyReceivedBlock prb, boolean
fromStore, double closestLocation) {
+ PeerNode source, Node node, PartiallyReceivedBlock prb, boolean
fromStore) {
this.myKey = myKey;
this.target = myKey.toNormalizedDouble();
this.uid = uid;
@@ -174,7 +174,6 @@
this.node = node;
this.prb = prb;
this.fromStore = fromStore;
- this.closestLocation = closestLocation;
this.startTime = System.currentTimeMillis();
this.backgroundTransfers = new Vector();
logMINOR = Logger.shouldLog(Logger.MINOR, this);
@@ -202,7 +201,6 @@
final PartiallyReceivedBlock prb;
final boolean fromStore;
private boolean receiveFailed;
- final double closestLocation;
final long startTime;
private boolean sentRequest;
@@ -283,7 +281,6 @@
// Route it
PeerNode next;
// Can backtrack, so only route to nodes closer than we are to
target.
- double nextValue;
next = node.peers.closerPeer(source, nodesRoutedTo,
nodesNotIgnored, target, true, node.isAdvancedModeEnabled(), -1, null, null);
if(next == null) {
@@ -292,19 +289,14 @@
return;
}
- nextValue = next.getLocation();
-
if(logMINOR) Logger.minor(this, "Routing insert to "+next);
nodesRoutedTo.add(next);
Message req;
synchronized (this) {
- if(Location.distance(target, nextValue) >
Location.distance(target, closestLocation)) {
- if(logMINOR) Logger.minor(this, "Backtracking:
target="+target+" next="+nextValue+" closest="+closestLocation);
- htl = node.decrementHTL(sentRequest ? next : source,
htl);
- }
+ htl = node.decrementHTL(sentRequest ? next : source,
htl);
- req = DMT.createFNPInsertRequest(uid, htl, myKey,
closestLocation);
+ req = DMT.createFNPInsertRequest(uid, htl, myKey);
}
// Wait for ack or reject... will come before even a locally
generated DataReply
Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java 2008-02-19 16:44:14 UTC (rev
18067)
+++ trunk/freenet/src/freenet/node/Node.java 2008-02-19 17:21:34 UTC (rev
18068)
@@ -1888,7 +1888,7 @@
* a RequestSender, unless the HTL is 0, in which case NULL.
* RequestSender.
*/
- public Object makeRequestSender(Key key, short htl, long uid, PeerNode
source, double closestLocation, boolean resetClosestLocation, boolean
localOnly, boolean cache, boolean ignoreStore, boolean offersOnly) {
+ public Object makeRequestSender(Key key, short htl, long uid, PeerNode
source, boolean localOnly, boolean cache, boolean ignoreStore, boolean
offersOnly) {
logMINOR = Logger.shouldLog(Logger.MINOR, this);
if(logMINOR) Logger.minor(this, "makeRequestSender("+key+ ','
+htl+ ',' +uid+ ',' +source+") on "+getDarknetPortNumber());
// In store?
@@ -1947,7 +1947,7 @@
// 0 timeout so it doesn't prevent future requests),
and send it the data
// through ULPRs if it is found.
- sender = new RequestSender(key, null, htl, uid, this,
closestLocation, resetClosestLocation, source, offersOnly);
+ sender = new RequestSender(key, null, htl, uid, this,
source, offersOnly);
// RequestSender adds itself to requestSenders
}
sender.start();
@@ -2292,7 +2292,7 @@
* if it originated locally.
*/
public CHKInsertSender makeInsertSender(NodeCHK key, short htl, long
uid, PeerNode source,
- byte[] headers, PartiallyReceivedBlock prb, boolean
fromStore, double closestLoc, boolean cache) {
+ byte[] headers, PartiallyReceivedBlock prb, boolean
fromStore, boolean cache) {
logMINOR = Logger.shouldLog(Logger.MINOR, this);
if(logMINOR) Logger.minor(this, "makeInsertSender("+key+ ','
+htl+ ',' +uid+ ',' +source+",...,"+fromStore);
KeyHTLPair kh = new KeyHTLPair(key, htl, uid);
@@ -2306,7 +2306,7 @@
}
if(fromStore && !cache)
throw new IllegalArgumentException("From store = true
but cache = false !!!");
- is = new CHKInsertSender(key, uid, headers, htl, source, this,
prb, fromStore, closestLoc);
+ is = new CHKInsertSender(key, uid, headers, htl, source, this,
prb, fromStore);
is.start();
if(logMINOR) Logger.minor(this, is.toString()+" for
"+kh.toString());
// CHKInsertSender adds itself to insertSenders
@@ -2325,7 +2325,7 @@
* if it originated locally.
*/
public SSKInsertSender makeInsertSender(SSKBlock block, short htl, long
uid, PeerNode source,
- boolean fromStore, double closestLoc, boolean
resetClosestLoc, boolean cache) {
+ boolean fromStore, boolean cache) {
NodeSSK key = (NodeSSK) block.getKey();
if(key.getPubKey() == null) {
throw new IllegalArgumentException("No pub key when
inserting");
@@ -2344,7 +2344,7 @@
}
if(fromStore && !cache)
throw new IllegalArgumentException("From store = true
but cache = false !!!");
- is = new SSKInsertSender(block, uid, htl, source, this,
fromStore, closestLoc);
+ is = new SSKInsertSender(block, uid, htl, source, this,
fromStore);
is.start();
Logger.minor(this, is.toString()+" for "+kh.toString());
// SSKInsertSender adds itself to insertSenders
Modified: trunk/freenet/src/freenet/node/NodeClientCore.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeClientCore.java 2008-02-19 16:44:14 UTC
(rev 18067)
+++ trunk/freenet/src/freenet/node/NodeClientCore.java 2008-02-19 17:21:34 UTC
(rev 18068)
@@ -470,7 +470,7 @@
*/
void asyncGet(Key key, boolean cache, boolean offersOnly, long uid,
RequestSender.Listener listener) {
try {
- Object o = node.makeRequestSender(key, node.maxHTL(),
uid, null, node.getLocation(), false, false, cache, false, offersOnly);
+ Object o = node.makeRequestSender(key, node.maxHTL(),
uid, null, false, cache, false, offersOnly);
if(o instanceof CHKBlock) {
node.unlockUID(uid, false, false, true, false);
return; // Already have it.
@@ -509,7 +509,7 @@
throw new
LowLevelGetException(LowLevelGetException.INTERNAL_ERROR);
}
try {
- Object o = node.makeRequestSender(key.getNodeCHK(),
node.maxHTL(), uid, null, node.getLocation(), false, localOnly, cache,
ignoreStore, false);
+ Object o = node.makeRequestSender(key.getNodeCHK(),
node.maxHTL(), uid, null, localOnly, cache, ignoreStore, false);
if(o instanceof CHKBlock) {
try {
return new ClientCHKBlock((CHKBlock)o, key);
@@ -624,7 +624,7 @@
throw new
LowLevelGetException(LowLevelGetException.INTERNAL_ERROR);
}
try {
- Object o = node.makeRequestSender(key.getNodeKey(),
node.maxHTL(), uid, null, node.getLocation(), false, localOnly, cache,
ignoreStore, false);
+ Object o = node.makeRequestSender(key.getNodeKey(),
node.maxHTL(), uid, null, localOnly, cache, ignoreStore, false);
if(o instanceof SSKBlock) {
try {
SSKBlock block = (SSKBlock)o;
@@ -756,7 +756,7 @@
node.store(block);
}
is = node.makeInsertSender((NodeCHK)block.getKey(),
- node.maxHTL(), uid, null, headers, prb, false,
node.getLocation(), cache);
+ node.maxHTL(), uid, null, headers, prb, false,
cache);
boolean hasReceivedRejectedOverload = false;
// Wait for status
while(true) {
@@ -878,7 +878,7 @@
}
}
is = node.makeInsertSender(block,
- node.maxHTL(), uid, null, false,
node.getLocation(), false, cache);
+ node.maxHTL(), uid, null, false, cache);
boolean hasReceivedRejectedOverload = false;
// Wait for status
while(true) {
Modified: trunk/freenet/src/freenet/node/OpennetManager.java
===================================================================
--- trunk/freenet/src/freenet/node/OpennetManager.java 2008-02-19 16:44:14 UTC
(rev 18067)
+++ trunk/freenet/src/freenet/node/OpennetManager.java 2008-02-19 17:21:34 UTC
(rev 18068)
@@ -516,10 +516,10 @@
}
public long startSendAnnouncementRequest(long uid, PeerNode peer,
byte[] noderef, ByteCounter ctr,
- double target, short htl, double nearestLocSoFar)
throws NotConnectedException {
+ double target, short htl) throws NotConnectedException {
long xferUID = node.random.nextLong();
Message msg = DMT.createFNPOpennetAnnounceRequest(uid, xferUID,
noderef.length,
- paddedSize(noderef.length), target, htl,
nearestLocSoFar);
+ paddedSize(noderef.length), target, htl);
peer.sendAsync(msg, null, 0, ctr);
return xferUID;
}
Modified: trunk/freenet/src/freenet/node/RequestHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/RequestHandler.java 2008-02-19 16:44:14 UTC
(rev 18067)
+++ trunk/freenet/src/freenet/node/RequestHandler.java 2008-02-19 17:21:34 UTC
(rev 18068)
@@ -37,11 +37,9 @@
final long uid;
private short htl;
final PeerNode source;
- private double closestLoc;
private boolean needsPubKey;
final Key key;
private boolean finalTransferFailed = false;
- final boolean resetClosestLoc;
/** The RequestSender, if any */
private RequestSender rs;
private int status = RequestSender.NOT_FINISHED;
@@ -60,17 +58,8 @@
node = n;
uid = id;
this.source = source;
- closestLoc = req.getDouble(DMT.NEAREST_LOCATION);
- double myLoc = n.lm.getLocation();
this.htl = htl;
this.key = key;
- double keyLoc = key.toNormalizedDouble();
- if(Location.distance(keyLoc, myLoc) < Location.distance(keyLoc,
closestLoc)) {
- closestLoc = myLoc;
- htl = node.maxHTL();
- resetClosestLoc = true;
- } else
- resetClosestLoc = false;
if(key instanceof NodeSSK)
needsPubKey = m.getBoolean(DMT.NEED_PUB_KEY);
logMINOR = Logger.shouldLog(Logger.MINOR, this);
@@ -141,7 +130,7 @@
Message accepted = DMT.createFNPAccepted(uid);
source.sendAsync(accepted, null, 0, this);
- Object o = node.makeRequestSender(key, htl, uid, source, closestLoc,
resetClosestLoc, false, true, false, false);
+ Object o = node.makeRequestSender(key, htl, uid, source, false, true,
false, false);
if(o instanceof KeyBlock) {
returnLocalData((KeyBlock)o);
return;
Modified: trunk/freenet/src/freenet/node/RequestSender.java
===================================================================
--- trunk/freenet/src/freenet/node/RequestSender.java 2008-02-19 16:44:14 UTC
(rev 18067)
+++ trunk/freenet/src/freenet/node/RequestSender.java 2008-02-19 17:21:34 UTC
(rev 18068)
@@ -63,11 +63,9 @@
// Basics
final Key key;
final double target;
- final boolean resetNearestLoc;
private short htl;
final long uid;
final Node node;
- private double nearestLoc;
/** The source of this request if any - purely so we can avoid routing to
it */
final PeerNode source;
private PartiallyReceivedBlock prb;
@@ -146,7 +144,7 @@
* @param key The key to request. Its public key should have been looked up
* already; RequestSender will not look it up.
*/
- public RequestSender(Key key, DSAPublicKey pubKey, short htl, long uid,
Node n, double nearestLoc, boolean resetNearestLoc,
+ public RequestSender(Key key, DSAPublicKey pubKey, short htl, long uid,
Node n,
PeerNode source, boolean offersOnly) {
this.key = key;
this.pubKey = pubKey;
@@ -154,8 +152,6 @@
this.uid = uid;
this.node = n;
this.source = source;
- this.nearestLoc = nearestLoc;
- this.resetNearestLoc = resetNearestLoc;
this.tryOffersOnly = offersOnly;
target = key.toNormalizedDouble();
node.addRequestSender(key, htl, this);
@@ -410,15 +406,10 @@
return;
}
- double nextValue=next.getLocation();
-
if(logMINOR) Logger.minor(this, "Routing request to "+next);
nodesRoutedTo.add(next);
- if(Location.distance(target, nextValue) >
Location.distance(target, nearestLoc)) {
- htl = node.decrementHTL((hasForwarded ? next : source), htl);
- if(logMINOR) Logger.minor(this, "Backtracking:
target="+target+" next="+nextValue+" closest="+nearestLoc+" so htl="+htl);
- }
+ htl = node.decrementHTL((hasForwarded ? next : source), htl);
Message req = createDataRequest();
@@ -841,9 +832,9 @@
private Message createDataRequest() {
if(key instanceof NodeCHK)
- return DMT.createFNPCHKDataRequest(uid, htl, (NodeCHK)key,
nearestLoc);
+ return DMT.createFNPCHKDataRequest(uid, htl, (NodeCHK)key);
else if(key instanceof NodeSSK)
- return DMT.createFNPSSKDataRequest(uid, htl, (NodeSSK)key,
nearestLoc, pubKey == null);
+ return DMT.createFNPSSKDataRequest(uid, htl, (NodeSSK)key,
pubKey == null);
else throw new IllegalStateException("Unknown keytype: "+key);
}
Modified: trunk/freenet/src/freenet/node/SSKInsertHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/SSKInsertHandler.java 2008-02-19
16:44:14 UTC (rev 18067)
+++ trunk/freenet/src/freenet/node/SSKInsertHandler.java 2008-02-19
17:21:34 UTC (rev 18068)
@@ -38,8 +38,6 @@
final long startTime;
private SSKBlock block;
private DSAPublicKey pubKey;
- private double closestLoc;
- private final boolean resetClosestLoc;
private short htl;
private SSKInsertSender sender;
private byte[] data;
@@ -54,14 +52,6 @@
this.startTime = startTime;
key = (NodeSSK) req.getObject(DMT.FREENET_ROUTING_KEY);
htl = req.getShort(DMT.HTL);
- closestLoc = req.getDouble(DMT.NEAREST_LOCATION);
- double targetLoc = key.toNormalizedDouble();
- double myLoc = node.lm.getLocation();
- if(Location.distance(targetLoc, myLoc) < Location.distance(targetLoc,
closestLoc)) {
- closestLoc = myLoc;
- htl = node.maxHTL();
- resetClosestLoc = true;
- } else resetClosestLoc = false;
byte[] pubKeyHash =
((ShortBuffer)req.getObject(DMT.PUBKEY_HASH)).getData();
pubKey = node.getKey(pubKeyHash);
data = ((ShortBuffer) req.getObject(DMT.DATA)).getData();
@@ -181,7 +171,7 @@
}
if(htl > 0)
- sender = node.makeInsertSender(block, htl, uid, source, false,
closestLoc, resetClosestLoc, true);
+ sender = node.makeInsertSender(block, htl, uid, source, false,
true);
boolean receivedRejectedOverload = false;
Modified: trunk/freenet/src/freenet/node/SSKInsertSender.java
===================================================================
--- trunk/freenet/src/freenet/node/SSKInsertSender.java 2008-02-19 16:44:14 UTC
(rev 18067)
+++ trunk/freenet/src/freenet/node/SSKInsertSender.java 2008-02-19 17:21:34 UTC
(rev 18068)
@@ -51,7 +51,6 @@
/** Headers (we know at start of insert) - can change if we get a
collision */
byte[] headers;
final boolean fromStore;
- final double closestLocation;
final long startTime;
private boolean sentRequest;
private boolean hasCollided;
@@ -75,10 +74,9 @@
/** Could not get off the node at all! */
static final int ROUTE_REALLY_NOT_FOUND = 6;
- SSKInsertSender(SSKBlock block, long uid, short htl, PeerNode source, Node
node, boolean fromStore, double closestLoc) {
+ SSKInsertSender(SSKBlock block, long uid, short htl, PeerNode source, Node
node, boolean fromStore) {
logMINOR = Logger.shouldLog(Logger.MINOR, this);
this.fromStore = fromStore;
- this.closestLocation = closestLoc;
this.node = node;
this.source = source;
this.htl = htl;
@@ -134,14 +132,8 @@
// Route it
PeerNode next;
- // Can backtrack, so only route to nodes closer than we are to
target.
- double nextValue;
synchronized(node.peers) {
next = node.peers.closerPeer(source, nodesRoutedTo,
nodesNotIgnored, target, true, node.isAdvancedModeEnabled(), -1, null, null);
- if(next != null)
- nextValue = next.getLocation();
- else
- nextValue = -1.0;
}
if(next == null) {
@@ -152,12 +144,9 @@
if(logMINOR) Logger.minor(this, "Routing insert to "+next);
nodesRoutedTo.add(next);
- if(Location.distance(target, nextValue) >
Location.distance(target, closestLocation)) {
- if(logMINOR) Logger.minor(this, "Backtracking:
target="+target+" next="+nextValue+" closest="+closestLocation);
- htl = node.decrementHTL(sentRequest ? next : source, htl);
- }
+ htl = node.decrementHTL(sentRequest ? next : source, htl);
- Message req = DMT.createFNPSSKInsertRequest(uid, htl, myKey,
closestLocation, headers, data, pubKeyHash);
+ Message req = DMT.createFNPSSKInsertRequest(uid, htl, myKey,
headers, data, pubKeyHash);
// Wait for ack or reject... will come before even a locally
generated DataReply