Author: toad
Date: 2007-06-22 14:55:03 +0000 (Fri, 22 Jun 2007)
New Revision: 13707

Modified:
   trunk/freenet/src/freenet/io/comm/DMT.java
   trunk/freenet/src/freenet/node/GlobalProbe.java
   trunk/freenet/src/freenet/node/NodeDispatcher.java
   trunk/freenet/src/freenet/node/ProbeCallback.java
   trunk/freenet/src/freenet/node/TextModeClientInterface.java
Log:
Include fork count on probe trace message (note that this does break 
compatibility)

Modified: trunk/freenet/src/freenet/io/comm/DMT.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/DMT.java  2007-06-22 14:53:17 UTC (rev 
13706)
+++ trunk/freenet/src/freenet/io/comm/DMT.java  2007-06-22 14:55:03 UTC (rev 
13707)
@@ -111,6 +111,7 @@
        public static final String PING_TIME = "pingTime";
        public static final String BWLIMIT_DELAY_TIME = "bwlimitDelayTime";
        public static final String TIME = "time";
+       public static final String FORK_COUNT = "forkCount";

        //Diagnostic
        public static final MessageType ping = new MessageType("ping") {{
@@ -772,9 +773,10 @@
                addField(MY_UID, Long.class);
                addField(PEER_LOCATIONS, ShortBuffer.class);
                addField(PEER_UIDS, ShortBuffer.class);
+               addField(FORK_COUNT, Short.class);
        }};

-       public static Message createFNPProbeTrace(long uid, double target, 
double nearest, double best, short htl, short counter, double myLoc, long 
swapIdentifier, double[] peerLocs, long[] peerUIDs) {
+       public static Message createFNPProbeTrace(long uid, double target, 
double nearest, double best, short htl, short counter, double myLoc, long 
swapIdentifier, double[] peerLocs, long[] peerUIDs, short forkCount) {
                Message msg = new Message(FNPProbeTrace);
                msg.set(UID, uid);
                msg.set(TARGET_LOCATION, target);
@@ -786,6 +788,7 @@
                msg.set(MY_UID, swapIdentifier);
                msg.set(PEER_LOCATIONS, new 
ShortBuffer(Fields.doublesToBytes(peerLocs)));
                msg.set(PEER_UIDS, new 
ShortBuffer(Fields.longsToBytes(peerUIDs)));
+               msg.set(FORK_COUNT, forkCount);
                return msg;
        }


Modified: trunk/freenet/src/freenet/node/GlobalProbe.java
===================================================================
--- trunk/freenet/src/freenet/node/GlobalProbe.java     2007-06-22 14:53:17 UTC 
(rev 13706)
+++ trunk/freenet/src/freenet/node/GlobalProbe.java     2007-06-22 14:55:03 UTC 
(rev 13707)
@@ -30,8 +30,8 @@
                                }
                        }

-                       public void onTrace(long uid, double target, double 
nearest, double best, short htl, short counter, double location, long nodeUID, 
double[] peerLocs, long[] peerUIDs, double[] locsNotVisited) {
-                               String msg = "Probe trace: UID="+uid+" 
target="+target+" nearest="+nearest+" best="+best+" htl="+htl+" 
counter="+counter+" location="+location+" node UID="+nodeUID+" peer 
locs="+StringArray.toString(peerLocs)+" peer 
UIDs="+StringArray.toString(peerUIDs)+" locs not visited: 
"+StringArray.toString(locsNotVisited);
+                       public void onTrace(long uid, double target, double 
nearest, double best, short htl, short counter, double location, long nodeUID, 
double[] peerLocs, long[] peerUIDs, double[] locsNotVisited, short forkCount) {
+                               String msg = "Probe trace: UID="+uid+" 
target="+target+" nearest="+nearest+" best="+best+" htl="+htl+" 
counter="+counter+" location="+location+" node UID="+nodeUID+" peer 
locs="+StringArray.toString(peerLocs)+" peer 
UIDs="+StringArray.toString(peerUIDs)+" locs not visited: 
"+StringArray.toString(locsNotVisited)+" fork count: "+forkCount;
                                Logger.error(this, msg);
                        }
        };

Modified: trunk/freenet/src/freenet/node/NodeDispatcher.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeDispatcher.java  2007-06-22 14:53:17 UTC 
(rev 13706)
+++ trunk/freenet/src/freenet/node/NodeDispatcher.java  2007-06-22 14:55:03 UTC 
(rev 13707)
@@ -443,7 +443,7 @@
                double nearest;
                double best;
                Vector notVisitedList; // List of best locations not yet 
visited by this request
-               int forkCount;
+               short forkCount;

                public ProbeContext(long id, double target, double best, double 
nearest, short htl, short counter, PeerNode src, ProbeCallback cb) {
                        visitedPeers = new HashSet();
@@ -718,7 +718,7 @@

                        if(src != null) {
                                Message trace =
-                                       DMT.createFNPProbeTrace(id, target, 
nearest, best, htl, counter, myLoc, node.swapIdentifier, 
LocationManager.extractLocs(peers, true), LocationManager.extractUIDs(peers));
+                                       DMT.createFNPProbeTrace(id, target, 
nearest, best, htl, counter, myLoc, node.swapIdentifier, 
LocationManager.extractLocs(peers, true), LocationManager.extractUIDs(peers), 
ctx.forkCount);
                                trace.addSubMessage(sub);
                                try {
                                        src.sendAsync(trace, null, 0, null);
@@ -762,7 +762,8 @@
                if(notVisited != null) {
                        locsNotVisited = 
Fields.bytesToDoubles(((ShortBuffer)notVisited.getObject(DMT.BEST_LOCATIONS_NOT_VISITED)).getData());
                }
-               ctx.cb.onTrace(uid, target, nearest, best, htl, counter, 
location, nodeUID, peerLocs, peerUIDs, locsNotVisited);
+               short forkCount = msg.getShort(DMT.FORK_COUNT);
+               ctx.cb.onTrace(uid, target, nearest, best, htl, counter, 
location, nodeUID, peerLocs, peerUIDs, locsNotVisited, forkCount);
        }

        private boolean handleProbeReply(Message m, PeerNode src) {

Modified: trunk/freenet/src/freenet/node/ProbeCallback.java
===================================================================
--- trunk/freenet/src/freenet/node/ProbeCallback.java   2007-06-22 14:53:17 UTC 
(rev 13706)
+++ trunk/freenet/src/freenet/node/ProbeCallback.java   2007-06-22 14:55:03 UTC 
(rev 13707)
@@ -8,6 +8,6 @@

        void onCompleted(String reason, double target, double best, double 
nearest, long id, short counter);

-       void onTrace(long uid, double target, double nearest, double best, 
short htl, short counter, double location, long nodeUID, double[] peerLocs, 
long[] peerUIDs, double[] locsNotVisited);
+       void onTrace(long uid, double target, double nearest, double best, 
short htl, short counter, double location, long nodeUID, double[] peerLocs, 
long[] peerUIDs, double[] locsNotVisited, short forkCount);

 }

Modified: trunk/freenet/src/freenet/node/TextModeClientInterface.java
===================================================================
--- trunk/freenet/src/freenet/node/TextModeClientInterface.java 2007-06-22 
14:53:17 UTC (rev 13706)
+++ trunk/freenet/src/freenet/node/TextModeClientInterface.java 2007-06-22 
14:55:03 UTC (rev 13707)
@@ -831,8 +831,8 @@
                                        }
                                }

-                               public void onTrace(long uid, double target, 
double nearest, double best, short htl, short counter, double location, long 
nodeUID, double[] peerLocs, long[] peerUIDs, double[] locsNotVisited) {
-                                       String msg = "Probe trace: UID="+uid+" 
target="+target+" nearest="+nearest+" best="+best+" htl="+htl+" 
counter="+counter+" location="+location+"node UID="+nodeUID+" peer 
locs="+StringArray.toString(peerLocs)+" peer 
UIDs="+StringArray.toString(peerUIDs)+" locs not visited = 
"+StringArray.toString(locsNotVisited);
+                               public void onTrace(long uid, double target, 
double nearest, double best, short htl, short counter, double location, long 
nodeUID, double[] peerLocs, long[] peerUIDs, double[] locsNotVisited, short 
forkCount) {
+                                       String msg = "Probe trace: UID="+uid+" 
target="+target+" nearest="+nearest+" best="+best+" htl="+htl+" 
counter="+counter+" location="+location+"node UID="+nodeUID+" peer 
locs="+StringArray.toString(peerLocs)+" peer 
UIDs="+StringArray.toString(peerUIDs)+" locs not visited = 
"+StringArray.toString(locsNotVisited)+" forks: "+forkCount;
                                        System.err.println(msg);
                                }
                };


Reply via email to