Author: toad
Date: 2008-02-13 16:50:23 +0000 (Wed, 13 Feb 2008)
New Revision: 17866

Modified:
   trunk/freenet/src/freenet/node/NodeDispatcher.java
Log:
Routed ping: once reach 0 htl, that's it, that's a DNF. Do not continue to try 
every direct neighbour of every node on the path.

Modified: trunk/freenet/src/freenet/node/NodeDispatcher.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeDispatcher.java  2008-02-13 16:46:36 UTC 
(rev 17865)
+++ trunk/freenet/src/freenet/node/NodeDispatcher.java  2008-02-13 16:50:23 UTC 
(rev 17866)
@@ -515,8 +515,21 @@
                        htl = rc.source.decrementHTL(htl);
                short ohtl = m.getShort(DMT.HTL);
                if(ohtl < htl) htl = ohtl;
-               // Try routing to the next node
-               forward(rc.msg, id, rc.source, htl, 
rc.msg.getDouble(DMT.TARGET_LOCATION), rc);
+               if(htl == 0) {
+                       // Equivalent to DNF.
+                       // Relay.
+                       if(rc.source == null) {
+                               try {
+                                       
rc.source.sendAsync(DMT.createFNPRoutedRejected(id, (short)0), null, 0, null);
+                               } catch (NotConnectedException e) {
+                                       // Ouch.
+                                       Logger.error(this, "Unable to relay 
probe DNF: peer disconnected: "+rc.source);
+                               }
+                       }
+               } else {
+                       // Try routing to the next node
+                       forward(rc.msg, id, rc.source, htl, 
rc.msg.getDouble(DMT.TARGET_LOCATION), rc);
+               }
                return true;
        }



Reply via email to