Author: toad
Date: 2008-02-06 00:56:43 +0000 (Wed, 06 Feb 2008)
New Revision: 17580

Modified:
   trunk/freenet/src/freenet/node/RequestSender.java
Log:
Create the data request before decrementing HTL so it doesn't get decremented 
twice.

Modified: trunk/freenet/src/freenet/node/RequestSender.java
===================================================================
--- trunk/freenet/src/freenet/node/RequestSender.java   2008-02-06 00:53:06 UTC 
(rev 17579)
+++ trunk/freenet/src/freenet/node/RequestSender.java   2008-02-06 00:56:43 UTC 
(rev 17580)
@@ -407,13 +407,14 @@
             if(logMINOR) Logger.minor(this, "Routing request to "+next);
             nodesRoutedTo.add(next);

+            // Create the data request *before* decrementing HTL, so it 
doesn't get decremented twice.
+            Message req = createDataRequest();
+            
             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);
             }

-            Message req = createDataRequest();
-            
             // Not possible to get an accurate time for sending, guaranteed to 
be not later than the time of receipt.
             // Why? Because by the time the sent() callback gets called, it 
may already have been acked, under heavy load.
             // So take it from when we first started to try to send the 
request.


Reply via email to