Author: toad
Date: 2007-07-17 17:39:11 +0000 (Tue, 17 Jul 2007)
New Revision: 14168

Modified:
   trunk/freenet/src/freenet/node/NodeDispatcher.java
Log:
send a completion trace

Modified: trunk/freenet/src/freenet/node/NodeDispatcher.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeDispatcher.java  2007-07-17 17:30:56 UTC 
(rev 14167)
+++ trunk/freenet/src/freenet/node/NodeDispatcher.java  2007-07-17 17:39:11 UTC 
(rev 14168)
@@ -837,9 +837,29 @@
                        while(recentProbeContexts.size() > MAX_PROBE_CONTEXTS)
                                recentProbeContexts.popValue();
                }
+               PeerNode origSource = (PeerNode) ctx.getSource();

+               Message sub = m.getSubMessage(DMT.FNPBestRoutesNotTaken);
+
+               try {
+               // Send a completion trace
+               PeerNode[] peers = node.getConnectedPeers();
+               Message trace =
+                       DMT.createFNPProbeTrace(id, target, nearest, best, 
ctx.htl, counter, node.getLocation(), node.swapIdentifier, 
LocationManager.extractLocs(peers, true), LocationManager.extractUIDs(peers), 
ctx.forkCount, linearCounter, "replying", src == null ? -1 : 
src.swapIdentifier);
+               trace.addSubMessage(sub);
+               try {
+                       origSource.sendAsync(trace, null, 0, null);
+               } catch (NotConnectedException e1) {
+                       // Ignore
+               }
+               } catch (Throwable t) {
+                       Logger.error(this, "Could not send completion trace: 
"+t, t);
+               }
+               
                // Maybe fork

+               
+               
                try {
                double furthestDist = 0.0;
                if(notVisitedList.size() > 0) {
@@ -878,10 +898,8 @@
                }

                // Just propagate back to source
-               PeerNode origSource = (PeerNode) ctx.getSource();
                if(origSource != null) {
                        Message complete = DMT.createFNPProbeReply(id, target, 
nearest, best, counter++, linearCounter);
-                       Message sub = 
m.getSubMessage(DMT.FNPBestRoutesNotTaken);
                        if(sub != null) complete.addSubMessage(sub);
                        try {
                                origSource.sendAsync(complete, null, 0, null);


Reply via email to