Author: toad
Date: 2008-03-06 15:52:43 +0000 (Thu, 06 Mar 2008)
New Revision: 18394

Modified:
   trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
   trunk/freenet/src/freenet/node/AnnounceSender.java
   trunk/freenet/src/freenet/node/DarknetPeerNode.java
   trunk/freenet/src/freenet/node/FailureTable.java
   trunk/freenet/src/freenet/node/LocationManager.java
   trunk/freenet/src/freenet/node/NetworkIDManager.java
   trunk/freenet/src/freenet/node/NodeDispatcher.java
   trunk/freenet/src/freenet/node/NodeStats.java
   trunk/freenet/src/freenet/node/PeerManager.java
   trunk/freenet/src/freenet/node/PeerNode.java
   trunk/freenet/src/freenet/node/SendMessageOnErrorCallback.java
   trunk/freenet/src/freenet/node/updater/UpdateOverMandatoryManager.java
Log:
Track sent bytes used by EVERY message send.

Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2008-03-06 15:52:16 UTC (rev 18393)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java       
2008-03-06 15:52:43 UTC (rev 18394)
@@ -811,25 +811,41 @@
                        long totalBytesSentCHKInserts = 
node.nodeStats.getCHKInsertTotalBytesSent();
                        long totalBytesSentSSKInserts = 
node.nodeStats.getSSKInsertTotalBytesSent();
                        long totalBytesSentOfferedKeys = 
node.nodeStats.getOfferedKeysTotalBytesSent();
+                       long totalBytesSendOffers = 
node.nodeStats.getOffersSentBytesSent();
                        long totalBytesSentSwapOutput = 
node.nodeStats.getSwappingTotalBytesSent();
                        long totalBytesSentAuth = 
node.nodeStats.getTotalAuthBytesSent();
                        long totalBytesSentResends = 
node.nodeStats.getResendBytesSent();
                        long totalBytesSentUOM = 
node.nodeStats.getUOMBytesSent();
                        long totalBytesSentAnnounce = 
node.nodeStats.getAnnounceBytesSent();
+                       long totalBytesSentRoutingStatus = 
node.nodeStats.getRoutingStatusBytes();
+                       long totalBytesSentNetworkColoring = 
node.nodeStats.getNetworkColoringSentBytes();
+                       long totalBytesSentPing = 
node.nodeStats.getPingSentBytes();
+                       long totalBytesSentProbeRequest = 
node.nodeStats.getProbeRequestSentBytes();
+                       long totalBytesSentRouted = 
node.nodeStats.getRoutedMessageSentBytes();
+                       long totalBytesSentDisconn = 
node.nodeStats.getDisconnBytesSent();
+                       long totalBytesSentInitial = 
node.nodeStats.getInitialMessagesBytesSent();
+                       long totalBytesSentChangedIP = 
node.nodeStats.getChangedIPBytesSent();
+                       long totalBytesSentNodeToNode = 
node.nodeStats.getNodeToNodeBytesSent();
                        long totalBytesSentRemaining = total[0] - 
                                (totalPayload + totalBytesSentCHKRequests + 
totalBytesSentSSKRequests +
                                totalBytesSentCHKInserts + 
totalBytesSentSSKInserts +
-                               totalBytesSentOfferedKeys + 
totalBytesSentSwapOutput + 
+                               totalBytesSentOfferedKeys + 
totalBytesSendOffers + totalBytesSentSwapOutput + 
                                totalBytesSentAuth + totalBytesSentResends +
-                               totalBytesSentUOM + totalBytesSentAnnounce);
+                               totalBytesSentUOM + totalBytesSentAnnounce + 
+                               totalBytesSentRoutingStatus + 
totalBytesSentNetworkColoring + totalBytesSentPing +
+                               totalBytesSentProbeRequest + 
totalBytesSentRouted + totalBytesSentDisconn + 
+                               totalBytesSentInitial + 
totalBytesSentChangedIP);
                        activityList.addChild("li", l10n("requestOutput", new 
String[] { "chk", "ssk" }, new String[] { 
SizeUtil.formatSize(totalBytesSentCHKRequests, true), 
SizeUtil.formatSize(totalBytesSentSSKRequests, true) }));
                        activityList.addChild("li", l10n("insertOutput", new 
String[] { "chk", "ssk" }, new String[] { 
SizeUtil.formatSize(totalBytesSentCHKInserts, true), 
SizeUtil.formatSize(totalBytesSentSSKInserts, true) }));
-                       activityList.addChild("li", l10n("offeredKeyOutput", 
"total", SizeUtil.formatSize(totalBytesSentOfferedKeys, true)));
+                       activityList.addChild("li", l10n("offeredKeyOutput", 
new String[] { "total", "offered" }, new String[] { 
SizeUtil.formatSize(totalBytesSentOfferedKeys, true), 
SizeUtil.formatSize(totalBytesSendOffers, true) }));
                        activityList.addChild("li", l10n("swapOutput", "total", 
SizeUtil.formatSize(totalBytesSentSwapOutput, true)));
                        activityList.addChild("li", l10n("authBytes", "total", 
SizeUtil.formatSize(totalBytesSentAuth, true)));
                        activityList.addChild("li", l10n("resendBytes", 
"total", SizeUtil.formatSize(totalBytesSentResends, true)));
                        activityList.addChild("li", l10n("uomBytes", "total",  
SizeUtil.formatSize(totalBytesSentUOM, true)));
                        activityList.addChild("li", l10n("announceBytes", 
"total", SizeUtil.formatSize(totalBytesSentAnnounce, true)));
+                       activityList.addChild("li", l10n("adminBytes", new 
String[] { "routingStatus", "disconn", "initial", "changedIP" }, new String[] { 
SizeUtil.formatSize(totalBytesSentRoutingStatus, true), 
SizeUtil.formatSize(totalBytesSentDisconn, true), 
SizeUtil.formatSize(totalBytesSentInitial, true), 
SizeUtil.formatSize(totalBytesSentChangedIP, true) }));
+                       activityList.addChild("li", l10n("debuggingBytes", new 
String[] { "netColoring", "ping", "probe", "routed" }, new String[] { 
SizeUtil.formatSize(totalBytesSentNetworkColoring, true), 
SizeUtil.formatSize(totalBytesSentPing, true), 
SizeUtil.formatSize(totalBytesSentProbeRequest, true), 
SizeUtil.formatSize(totalBytesSentRouted, true) } ));
+                       activityList.addChild("li", l10n("nodeToNodeBytes", 
"total", SizeUtil.formatSize(totalBytesSentNodeToNode, true)));
                        activityList.addChild("li", l10n("unaccountedBytes", 
new String[] { "total", "percent" },
                                        new String[] { 
SizeUtil.formatSize(totalBytesSentRemaining, true), 
Integer.toString((int)(totalBytesSentRemaining*100 / total[0])) }));
                }

Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-03-06 
15:52:16 UTC (rev 18393)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-03-06 
15:52:43 UTC (rev 18394)
@@ -968,11 +968,13 @@
 StaticToadlet.pathNotFoundTitle=Path Not Found
 StatisticsToadlet.activityInserts=Inserts: ${totalSenders} total senders, 
${CHKhandlers} CHK handlers, ${SSKhandlers} SSK handlers
 StatisticsToadlet.activityRequests=Requests: ${totalSenders} total senders, 
${CHKhandlers} CHK handlers, ${SSKhandlers} SSK handlers
+StatisticsToadlet.adminBytes=Admin bytes: ${initial} initial messages, 
${changedIP} IP change messages, ${disconn} disconnection notifications, 
${routingStatus} routing status
 StatisticsToadlet.allocMemory=Allocated Java memory: ${memory}
 StatisticsToadlet.announceBytes=Announcement output: ${total}
 StatisticsToadlet.authBytes=Connection setup: ${total} output
 StatisticsToadlet.bandwidthTitle=Bandwidth
 StatisticsToadlet.cpus=Available CPUs: ${count}
+StatisticsToadlet.debuggingBytes=Debugging bytes: ${netColoring} network 
coloring, ${ping} ping, ${probe} probe requests, ${routed} routed test messages.
 StatisticsToadlet.fullTitle=Statistics for ${name}
 StatisticsToadlet.getLogs=Get latest node's logfile
 StatisticsToadlet.inputRate=Input Rate: ${rate}/sec (of ${max})
@@ -982,9 +984,10 @@
 StatisticsToadlet.jvmVendor=JVM Vendor: ${vendor}
 StatisticsToadlet.jvmVersion=JVM Version: ${version}
 StatisticsToadlet.maxMemory=Maximum Java memory: ${memory}
+StatisticsToadlet.nodeToNodeBytes=Node to node messages: ${total}
 StatisticsToadlet.noRequests=Your node is not processing any requests right 
now.
 StatisticsToadlet.offerReplys=Running offer replys: ${chk} CHK, ${ssk} SSK.
-StatisticsToadlet.offeredKeyOutput=Sending offered keys output (not payload): 
${total}
+StatisticsToadlet.offeredKeyOutput=Offered keys: sending keys ${total}, 
sending offers ${offered}
 StatisticsToadlet.osArch=OS Architecture: ${arch}
 StatisticsToadlet.osName=OS Name: ${name}
 StatisticsToadlet.osVersion=OS Version: ${version}

Modified: trunk/freenet/src/freenet/node/AnnounceSender.java
===================================================================
--- trunk/freenet/src/freenet/node/AnnounceSender.java  2008-03-06 15:52:16 UTC 
(rev 18393)
+++ trunk/freenet/src/freenet/node/AnnounceSender.java  2008-03-06 15:52:43 UTC 
(rev 18394)
@@ -83,7 +83,7 @@
                boolean hasForwarded = false;
                if(source != null) {
                        try {
-                               source.sendAsync(DMT.createFNPAccepted(uid), 
null, 0, null);
+                               source.sendAsync(DMT.createFNPAccepted(uid), 
null, 0, this);
                        } catch (NotConnectedException e) {
                                return;
                        }

Modified: trunk/freenet/src/freenet/node/DarknetPeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/DarknetPeerNode.java 2008-03-06 15:52:16 UTC 
(rev 18393)
+++ trunk/freenet/src/freenet/node/DarknetPeerNode.java 2008-03-06 15:52:43 UTC 
(rev 18394)
@@ -276,14 +276,13 @@
                        ignoreSourcePort = setting;
                }
        }
-       
+
        /**
         * Change the routing status of a peer
         * 
         * @param shouldRoute
         * @param localRequest (true everywhere but in NodeDispatcher)
         */
-       
        public void setRoutingStatus(boolean shouldRoute, boolean localRequest) 
{
                synchronized(this) {
                        if(localRequest)
@@ -297,7 +296,7 @@
                if(localRequest) {
                        Message msg = DMT.createRoutingStatus(shouldRoute);
                        try {
-                               sendAsync(msg, null, 0, null);
+                               sendAsync(msg, null, 0, 
node.nodeStats.setRoutingStatusCtr);
                        } catch(NotConnectedException e) {
                        // ok
                        }
@@ -1277,7 +1276,7 @@
                                        Node.N2N_MESSAGE_TYPE_FPROXY, fs
                                                        
.toString().getBytes("UTF-8"));
                        try {
-                               sendAsync(n2ntm, null, 0, null);
+                               sendAsync(n2ntm, null, 0, 
node.nodeStats.nodeToNodeCounter);
                        } catch (NotConnectedException e) {
                                fs.removeValue("sentTime");
                                queueN2NM(fs);
@@ -1311,7 +1310,7 @@
                                        Node.N2N_MESSAGE_TYPE_FPROXY, fs
                                                        
.toString().getBytes("UTF-8"));
                        try {
-                               sendAsync(n2ntm, null, 0, null);
+                               sendAsync(n2ntm, null, 0, 
node.nodeStats.nodeToNodeCounter);
                        } catch (NotConnectedException e) {
                                fs.removeValue("sentTime");
                                queueN2NM(fs);
@@ -1354,7 +1353,7 @@
                                        Node.N2N_MESSAGE_TYPE_FPROXY, fs
                                                        
.toString().getBytes("UTF-8"));
                        try {
-                               sendAsync(n2ntm, null, 0, null);
+                               sendAsync(n2ntm, null, 0, 
node.nodeStats.nodeToNodeCounter);
                        } catch (NotConnectedException e) {
                                fs.removeValue("sentTime");
                                queueN2NM(fs);
@@ -1450,7 +1449,7 @@
                if(fo == null) {
                        Logger.error(this, "No such offer: "+uid);
                        try {
-                               sendAsync(DMT.createFNPBulkSendAborted(uid), 
null, fileNumber, null);
+                               sendAsync(DMT.createFNPBulkSendAborted(uid), 
null, fileNumber, node.nodeStats.nodeToNodeCounter);
                        } catch (NotConnectedException e) {
                                // Fine by me!
                        }

Modified: trunk/freenet/src/freenet/node/FailureTable.java
===================================================================
--- trunk/freenet/src/freenet/node/FailureTable.java    2008-03-06 15:52:16 UTC 
(rev 18393)
+++ trunk/freenet/src/freenet/node/FailureTable.java    2008-03-06 15:52:43 UTC 
(rev 18394)
@@ -393,7 +393,7 @@
                                return;
                        }
                        Message df = DMT.createFNPCHKDataFound(uid, 
block.getRawHeaders());
-                       source.sendAsync(df, null, 0, null);
+                       source.sendAsync(df, null, 0, senderCounter);
                PartiallyReceivedBlock prb =
                        new PartiallyReceivedBlock(Node.PACKETS_IN_BLOCK, 
Node.PACKET_SIZE, block.getRawData());
                final BlockTransmitter bt =
@@ -418,7 +418,7 @@
                }
        }

-       private final OfferedKeysByteCounter senderCounter = new 
OfferedKeysByteCounter();
+       public final OfferedKeysByteCounter senderCounter = new 
OfferedKeysByteCounter();

        class OfferedKeysByteCounter implements ByteCounter {


Modified: trunk/freenet/src/freenet/node/LocationManager.java
===================================================================
--- trunk/freenet/src/freenet/node/LocationManager.java 2008-03-06 15:52:16 UTC 
(rev 18393)
+++ trunk/freenet/src/freenet/node/LocationManager.java 2008-03-06 15:52:43 UTC 
(rev 18394)
@@ -37,7 +37,7 @@
         RecentlyForwardedItem item;

         public MyCallback(Message message, PeerNode pn, RecentlyForwardedItem 
item) {
-            super(message, pn);
+            super(message, pn, LocationManager.this);
             this.item = item;
         }

@@ -876,7 +876,7 @@
                     // Forward the request.
                     // Note that we MUST NOT send this blocking as we are on 
the
                     // receiver thread.
-                    randomPeer.sendAsync(m, new 
MyCallback(DMT.createFNPSwapRejected(oldID), pn, item), 0, null);
+                    randomPeer.sendAsync(m, new 
MyCallback(DMT.createFNPSwapRejected(oldID), pn, item), 0, 
LocationManager.this);
                 } catch (NotConnectedException e) {
                        if(logMINOR) Logger.minor(this, "Not connected");
                     // Try a different node
@@ -1048,7 +1048,7 @@
         // Sending onwards - use outgoing ID
         m.set(DMT.UID, item.outgoingID);
         try {
-            item.routedTo.sendAsync(m, new 
SendMessageOnErrorCallback(DMT.createFNPSwapRejected(item.incomingID), 
item.requestSender), 0, this);
+            item.routedTo.sendAsync(m, new 
SendMessageOnErrorCallback(DMT.createFNPSwapRejected(item.incomingID), 
item.requestSender, this), 0, this);
         } catch (NotConnectedException e) {
                if(logMINOR) Logger.minor(this, "Lost connection forwarding 
SwapCommit "+uid+" to "+item.routedTo);
         }
@@ -1192,7 +1192,7 @@
             Message msg = DMT.createFNPSwapRejected(item.incomingID);
             if(logMINOR) Logger.minor(this, "Rejecting in lostOrRestartedNode: 
"+item.incomingID+ " from "+item.requestSender);
             try {
-                item.requestSender.sendAsync(msg, null, 0, null);
+                item.requestSender.sendAsync(msg, null, 0, this);
             } catch (NotConnectedException e1) {
                 Logger.normal(this, "Both sender and receiver disconnected for 
"+item);
             }

Modified: trunk/freenet/src/freenet/node/NetworkIDManager.java
===================================================================
--- trunk/freenet/src/freenet/node/NetworkIDManager.java        2008-03-06 
15:52:16 UTC (rev 18393)
+++ trunk/freenet/src/freenet/node/NetworkIDManager.java        2008-03-06 
15:52:43 UTC (rev 18394)
@@ -11,6 +11,7 @@
 import java.util.List;
 import java.util.Map;

+import freenet.io.comm.ByteCounter;
 import freenet.io.comm.DMT;
 import freenet.io.comm.DisconnectedException;
 import freenet.io.comm.Message;
@@ -100,7 +101,7 @@
                if (logMINOR) Logger.minor(this, "Storing secret: "+s);
                addOrReplaceSecret(s);
                try {
-                       pn.sendAsync(DMT.createFNPAccepted(uid), null, 0, null);
+                       pn.sendAsync(DMT.createFNPAccepted(uid), null, 0, ctr);
                } catch (NotConnectedException e) {
                        Logger.error(this, "peer disconnected before 
storeSecret ack?", e);
                }
@@ -132,7 +133,7 @@

                if (disableSecretPings || node.recentlyCompleted(uid)) {
                        if (logMINOR) Logger.minor(this, "recently 
complete/loop: "+uid);
-                       source.sendAsync(DMT.createFNPRejectedLoop(uid), null, 
0, null);
+                       source.sendAsync(DMT.createFNPRejectedLoop(uid), null, 
0, ctr);
                } else {
                        byte[] nodeIdentity = ((ShortBuffer) 
m.getObject(DMT.NODE_IDENTITY)).getData();
                        StoredSecret match;
@@ -144,10 +145,10 @@
                                //This is the node that the ping intends to 
reach, we will *not* forward it; but we might not respond positively either.
                                //don't set the completed flag, we might reject 
it from one peer (too short a path) and accept it from another.
                                if (htl > dawnHtl) {
-                                       
source.sendAsync(DMT.createFNPRejectedLoop(uid), null, 0, null);
+                                       
source.sendAsync(DMT.createFNPRejectedLoop(uid), null, 0, ctr);
                                } else {
                                        if (logMINOR) Logger.minor(this, 
"Responding to "+source+" with "+match+" from "+match.peer);
-                                       
source.sendAsync(match.getSecretPong(counter+1), null, 0, null);
+                                       
source.sendAsync(match.getSecretPong(counter+1), null, 0, ctr);
                                }
                        } else {
                                //Set the completed flag immediately for 
determining reject loops rather than locking the uid.
@@ -168,7 +169,7 @@

                                        if (next==null) {
                                                //would be rnf... but this is a 
more exhaustive and lightweight search I suppose.
-                                               
source.sendAsync(DMT.createFNPRejectedLoop(uid), null, 0, null);
+                                               
source.sendAsync(DMT.createFNPRejectedLoop(uid), null, 0, ctr);
                                                break;
                                        }

@@ -176,7 +177,7 @@

                                        if (htl<=0) {
                                                //would be dnf if we were 
looking for data.
-                                               
source.sendAsync(DMT.createFNPRejectedLoop(uid), null, 0, null);
+                                               
source.sendAsync(DMT.createFNPRejectedLoop(uid), null, 0, ctr);
                                                break;
                                        }

@@ -187,7 +188,7 @@
                                        counter++;
                                        routedTo.add(next);
                                        try {
-                                               
next.sendAsync(DMT.createFNPSecretPing(uid, target, htl, dawnHtl, counter, 
nodeIdentity), null, 0, null);
+                                               
next.sendAsync(DMT.createFNPSecretPing(uid, target, htl, dawnHtl, counter, 
nodeIdentity), null, 0, ctr);
                                        } catch (NotConnectedException e) {
                                                Logger.normal(this, next+" 
disconnected before secret-ping-forward");
                                                continue;
@@ -217,7 +218,7 @@
                                                        counter=suppliedCounter;
                                                long 
secret=msg.getLong(DMT.SECRET);
                                                if (logMINOR) 
Logger.minor(this, node+" forwarding apparently-successful secretpong response: 
"+counter+"/"+secret+" from "+next+" to "+source);
-                                               
source.sendAsync(DMT.createFNPSecretPong(uid, counter, secret), null, 0, null);
+                                               
source.sendAsync(DMT.createFNPSecretPong(uid, counter, secret), null, 0, ctr);
                                                break;
                                        }

@@ -949,7 +950,7 @@
                                        p.assignedNetworkID=id;
                                        p.networkGroup=this;
                                        try {
-                                               p.sendFNPNetworkID();
+                                               p.sendFNPNetworkID(ctr);
                                        } catch (NotConnectedException e) {
                                                Logger.normal(this, 
"disconnected on network reassignment");
                                        }
@@ -1011,4 +1012,20 @@
                return b.members.size()-a.members.size();
        }

+       private final ByteCounter ctr = new ByteCounter() {
+
+               public void receivedBytes(int x) {
+                       node.nodeStats.networkColoringReceivedBytes(x);
+               }
+
+               public void sentBytes(int x) {
+                       node.nodeStats.networkColoringSentBytes(x);
+               }
+
+               public void sentPayload(int x) {
+                       node.nodeStats.networkColoringSentBytes(x);
+               }
+               
+       };
+       
 }
\ No newline at end of file

Modified: trunk/freenet/src/freenet/node/NodeDispatcher.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeDispatcher.java  2008-03-06 15:52:16 UTC 
(rev 18393)
+++ trunk/freenet/src/freenet/node/NodeDispatcher.java  2008-03-06 15:52:43 UTC 
(rev 18394)
@@ -8,6 +8,7 @@
 import java.util.Iterator;

 import freenet.crypt.HMAC;
+import freenet.io.comm.ByteCounter;
 import freenet.io.comm.DMT;
 import freenet.io.comm.Dispatcher;
 import freenet.io.comm.Message;
@@ -51,6 +52,22 @@
                node.getTicker().queueTimedJob(this, STALE_CONTEXT_CHECK);
        }

+       ByteCounter pingCounter = new ByteCounter() {
+
+               public void receivedBytes(int x) {
+                       node.nodeStats.pingCounterReceived(x);
+               }
+
+               public void sentBytes(int x) {
+                       node.nodeStats.pingCounterSent(x);
+               }
+
+               public void sentPayload(int x) {
+                       node.nodeStats.pingCounterSent(x);
+               }
+               
+       };
+       
        public boolean handleMessage(Message m) {
                logMINOR = Logger.shouldLog(Logger.MINOR, this);
                PeerNode source = (PeerNode)m.getSource();
@@ -64,7 +81,7 @@
                        // Send an FNPPong
                        Message reply = 
DMT.createFNPPong(m.getInt(DMT.PING_SEQNO));
                        try {
-                               source.sendAsync(reply, null, 0, null); // 
nothing we can do if can't contact source
+                               source.sendAsync(reply, null, 0, pingCounter); 
// nothing we can do if can't contact source
                        } catch (NotConnectedException e) {
                                if(logMINOR) Logger.minor(this, "Lost 
connection replying to "+m);
                        }
@@ -73,7 +90,7 @@
                        long id = m.getLong(DMT.PING_SEQNO);
                        Message msg = DMT.createFNPLinkPong(id);
                        try {
-                               source.sendAsync(msg, null, 0, null);
+                               source.sendAsync(msg, null, 0, pingCounter);
                        } catch (NotConnectedException e) {
                                // Ignore
                        }
@@ -193,7 +210,7 @@
                
if(!HMAC.verifyWithSHA256(node.failureTable.offerAuthenticatorKey, 
key.getFullKey(), authenticator)) {
                        Logger.error(this, "Invalid offer request from 
"+source+" : authenticator did not verify");
                        try {
-                               
source.sendAsync(DMT.createFNPGetOfferedKeyInvalid(uid, 
DMT.GET_OFFERED_KEY_REJECTED_BAD_AUTHENTICATOR), null, 0, null);
+                               
source.sendAsync(DMT.createFNPGetOfferedKeyInvalid(uid, 
DMT.GET_OFFERED_KEY_REJECTED_BAD_AUTHENTICATOR), null, 0, 
node.failureTable.senderCounter);
                        } catch (NotConnectedException e) {
                                // Too bad.
                        }
@@ -213,7 +230,7 @@
                        Logger.normal(this, "Rejecting FNPGetOfferedKey from 
"+source+" for "+key+" : "+reject);
                        Message rejected = DMT.createFNPRejectedOverload(uid, 
true);
                        try {
-                               source.sendAsync(rejected, null, 0, null);
+                               source.sendAsync(rejected, null, 0, 
node.failureTable.senderCounter);
                        } catch (NotConnectedException e) {
                                Logger.normal(this, "Rejecting (overload) data 
request from "+source.getPeer()+": "+e);
                        }
@@ -288,10 +305,11 @@
         */
        private boolean handleDataRequest(Message m, PeerNode source, boolean 
isSSK) {
                long id = m.getLong(DMT.UID);
+               ByteCounter ctr = isSSK ? node.nodeStats.sskRequestCtr : 
node.nodeStats.chkRequestCtr;
                if(node.recentlyCompleted(id)) {
                        Message rejected = DMT.createFNPRejectedLoop(id);
                        try {
-                               source.sendAsync(rejected, null, 0, null);
+                               source.sendAsync(rejected, null, 0, ctr);
                        } catch (NotConnectedException e) {
                                Logger.normal(this, "Rejecting data request 
(loop, finished): "+e);
                        }
@@ -303,7 +321,7 @@
                        if(logMINOR) Logger.minor(this, "Could not lock ID 
"+id+" -> rejecting (already running)");
                        Message rejected = DMT.createFNPRejectedLoop(id);
                        try {
-                               source.sendAsync(rejected, null, 0, null);
+                               source.sendAsync(rejected, null, 0, ctr);
                        } catch (NotConnectedException e) {
                                Logger.normal(this, "Rejecting request from 
"+source.getPeer()+": "+e);
                        }
@@ -318,7 +336,7 @@
                        Logger.normal(this, "Rejecting request from 
"+source.getPeer()+" preemptively because "+rejectReason);
                        Message rejected = DMT.createFNPRejectedOverload(id, 
true);
                        try {
-                               source.sendAsync(rejected, null, 0, null);
+                               source.sendAsync(rejected, null, 0, ctr);
                        } catch (NotConnectedException e) {
                                Logger.normal(this, "Rejecting (overload) data 
request from "+source.getPeer()+": "+e);
                        }
@@ -335,11 +353,12 @@
        }

        private boolean handleInsertRequest(Message m, PeerNode source, boolean 
isSSK) {
+               ByteCounter ctr = isSSK ? node.nodeStats.sskInsertCtr : 
node.nodeStats.chkInsertCtr;
                long id = m.getLong(DMT.UID);
                if(node.recentlyCompleted(id)) {
                        Message rejected = DMT.createFNPRejectedLoop(id);
                        try {
-                               source.sendAsync(rejected, null, 0, null);
+                               source.sendAsync(rejected, null, 0, ctr);
                        } catch (NotConnectedException e) {
                                Logger.normal(this, "Rejecting insert request 
from "+source.getPeer()+": "+e);
                        }
@@ -349,7 +368,7 @@
                        if(logMINOR) Logger.minor(this, "Could not lock ID 
"+id+" -> rejecting (already running)");
                        Message rejected = DMT.createFNPRejectedLoop(id);
                        try {
-                               source.sendAsync(rejected, null, 0, null);
+                               source.sendAsync(rejected, null, 0, ctr);
                        } catch (NotConnectedException e) {
                                Logger.normal(this, "Rejecting insert request 
from "+source.getPeer()+": "+e);
                        }
@@ -361,7 +380,7 @@
                        Logger.normal(this, "Rejecting insert from 
"+source.getPeer()+" preemptively because "+rejectReason);
                        Message rejected = DMT.createFNPRejectedOverload(id, 
true);
                        try {
-                               source.sendAsync(rejected, null, 0, null);
+                               source.sendAsync(rejected, null, 0, ctr);
                        } catch (NotConnectedException e) {
                                Logger.normal(this, "Rejecting (overload) 
insert request from "+source.getPeer()+": "+e);
                        }
@@ -385,7 +404,7 @@
                if(node.recentlyCompleted(id)) {
                        Message rejected = DMT.createFNPRejectedLoop(id);
                        try {
-                               source.sendAsync(rejected, null, 0, null);
+                               source.sendAsync(rejected, null, 0, 
node.nodeStats.probeRequestCtr);
                        } catch (NotConnectedException e) {
                                Logger.normal(this, "Rejecting probe request 
from "+source.getPeer()+": "+e);
                        }
@@ -398,7 +417,7 @@
                        Logger.normal(this, "Rejecting probe request from 
"+source.getPeer());
                        Message rejected = DMT.createFNPRejectedOverload(id, 
true);
                        try {
-                               source.sendAsync(rejected, null, 0, null);
+                               source.sendAsync(rejected, null, 0, 
node.nodeStats.probeRequestCtr);
                        } catch (NotConnectedException e) {
                                Logger.normal(this, "Rejecting (overload) 
insert request from "+source.getPeer()+": "+e);
                        }
@@ -409,7 +428,7 @@
                        Logger.normal(this, "Rejecting invalid 
(target="+target+") probe request from "+source.getPeer());
                        Message rejected = DMT.createFNPRejectedOverload(id, 
true);
                        try {
-                               source.sendAsync(rejected, null, 0, null);
+                               source.sendAsync(rejected, null, 0, 
node.nodeStats.probeRequestCtr);
                        } catch (NotConnectedException e) {
                                Logger.normal(this, "Rejecting (invalid) insert 
request from "+source.getPeer()+": "+e);
                        }
@@ -425,7 +444,7 @@
                if(om == null || !source.canAcceptAnnouncements()) {
                        Message msg = DMT.createFNPOpennetDisabled(uid);
                        try {
-                               source.sendAsync(msg, null, 0, null);
+                               source.sendAsync(msg, null, 0, 
node.nodeStats.announceByteCounter);
                        } catch (NotConnectedException e) {
                                // Ok
                        }
@@ -434,7 +453,7 @@
                if(node.recentlyCompleted(uid)) {
                        Message msg = DMT.createFNPRejectedLoop(uid);
                        try {
-                               source.sendAsync(msg, null, 0, null);
+                               source.sendAsync(msg, null, 0, 
node.nodeStats.announceByteCounter);
                        } catch (NotConnectedException e) {
                                // Ok
                        }
@@ -448,7 +467,7 @@
                        if(!source.shouldAcceptAnnounce(uid)) {
                                Message msg = 
DMT.createFNPRejectedOverload(uid, true);
                                try {
-                                       source.sendAsync(msg, null, 0, null);
+                                       source.sendAsync(msg, null, 0, 
node.nodeStats.announceByteCounter);
                                } catch (NotConnectedException e) {
                                        // Ok
                                }
@@ -530,7 +549,7 @@
                        // Relay.
                        if(rc.source == null) {
                                try {
-                                       
rc.source.sendAsync(DMT.createFNPRoutedRejected(id, (short)0), null, 0, null);
+                                       
rc.source.sendAsync(DMT.createFNPRoutedRejected(id, (short)0), null, 0, 
nodeStats.routedMessageCtr);
                                } catch (NotConnectedException e) {
                                        // Ouch.
                                        Logger.error(this, "Unable to relay 
probe DNF: peer disconnected: "+rc.source);
@@ -563,7 +582,7 @@
                ctx = (RoutedContext)routedContexts.get(lid);
                if(ctx != null) {
                        try {
-                               
source.sendAsync(DMT.createFNPRoutedRejected(id, (short)htl), null, 0, null);
+                               
source.sendAsync(DMT.createFNPRoutedRejected(id, (short)htl), null, 0, 
nodeStats.routedMessageCtr);
                        } catch (NotConnectedException e) {
                                if(logMINOR) Logger.minor(this, "Lost 
connection rejecting "+m);
                        }
@@ -585,7 +604,7 @@
                } else if(htl == 0) {
                        Message reject = DMT.createFNPRoutedRejected(id, 
(short)0);
                        if(source != null) try {
-                               source.sendAsync(reject, null, 0, null);
+                               source.sendAsync(reject, null, 0, 
nodeStats.routedMessageCtr);
                        } catch (NotConnectedException e) {
                                if(logMINOR) Logger.minor(this, "Lost 
connection rejecting "+m);
                        }
@@ -607,7 +626,7 @@
                PeerNode pn = ctx.source;
                if(pn == null) return false;
                try {
-                       pn.sendAsync(m, null, 0, null);
+                       pn.sendAsync(m, null, 0, nodeStats.routedMessageCtr);
                } catch (NotConnectedException e) {
                        if(logMINOR) Logger.minor(this, "Lost connection 
forwarding "+m+" to "+pn);
                }
@@ -632,7 +651,7 @@
                                if(logMINOR) Logger.minor(this, "Forwarding 
"+m.getSpec()+" to "+next.getPeer().getPort());
                                ctx.addSent(next);
                                try {
-                                       next.sendAsync(m, null, 0, null);
+                                       next.sendAsync(m, null, 0, 
nodeStats.routedMessageCtr);
                                } catch (NotConnectedException e) {
                                        continue;
                                }
@@ -641,7 +660,7 @@
                                // Reached a dead end...
                                Message reject = 
DMT.createFNPRoutedRejected(id, htl);
                                if(pn != null) try {
-                                       pn.sendAsync(reject, null, 0, null);
+                                       pn.sendAsync(reject, null, 0, 
nodeStats.routedMessageCtr);
                                } catch (NotConnectedException e) {
                                        Logger.error(this, "Cannot send reject 
message back to source "+pn);
                                        return true;
@@ -677,7 +696,7 @@
                        Message reply = DMT.createFNPRoutedPong(id, x);
                        if(logMINOR) Logger.minor(this, "Replying - counter = 
"+x+" for "+id);
                        try {
-                               src.sendAsync(reply, null, 0, null);
+                               src.sendAsync(reply, null, 0, 
nodeStats.routedMessageCtr);
                        } catch (NotConnectedException e) {
                                if(logMINOR) Logger.minor(this, "Lost 
connection replying to "+m+" in dispatchRoutedMessage");
                        }

Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java       2008-03-06 15:52:16 UTC 
(rev 18393)
+++ trunk/freenet/src/freenet/node/NodeStats.java       2008-03-06 15:52:43 UTC 
(rev 18394)
@@ -1108,6 +1108,35 @@
                return offeredKeysSenderSentBytes;
        }

+       private long offerKeysRcvdBytes;
+       private long offerKeysSentBytes;
+       
+       ByteCounter sendOffersCtr = new ByteCounter() {
+
+               public void receivedBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               offerKeysRcvdBytes += x;
+                       }
+               }
+
+               public void sentBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               offerKeysSentBytes += x;
+                       }
+               }
+
+               public void sentPayload(int x) {
+                       synchronized(NodeStats.this) {
+                               offerKeysSentBytes += x;
+                       }
+               }
+               
+       };
+       
+       public synchronized long getOffersSentBytesSent() {
+               return offerKeysSentBytes;
+       }
+       
        private long swappingRcvdBytes;
        private long swappingSentBytes;

@@ -1202,4 +1231,310 @@
        public long getAnnounceBytesSent() {
                return announceBytesSent;
        }
+       
+       private long routingStatusBytesSent;
+       
+       ByteCounter setRoutingStatusCtr = new ByteCounter() {
+
+               public void receivedBytes(int x) {
+                       // Impossible?
+                       Logger.error(this, "Routing status sender received 
bytes: "+x+" - isn't that impossible?");
+               }
+
+               public void sentBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               routingStatusBytesSent += x;
+                       }
+               }
+
+               public void sentPayload(int x) {
+                       synchronized(NodeStats.this) {
+                               routingStatusBytesSent += x;
+                       }
+               }
+               
+       };
+       
+       public synchronized long getRoutingStatusBytes() {
+               return routingStatusBytesSent;
+       }
+
+       private long networkColoringReceivedBytesCounter;
+       private long networkColoringSentBytesCounter;
+       
+       public synchronized void networkColoringReceivedBytes(int x) {
+               networkColoringReceivedBytesCounter += x;
+       }
+
+       public synchronized void networkColoringSentBytes(int x) {
+               networkColoringSentBytesCounter += x;
+       }
+
+       public synchronized long getNetworkColoringSentBytes() {
+               return networkColoringSentBytesCounter;
+       }
+       
+       private long pingBytesReceived;
+       private long pingBytesSent;
+       
+       public synchronized void pingCounterReceived(int x) {
+               pingBytesReceived += x;
+       }
+
+       public synchronized void pingCounterSent(int x) {
+               pingBytesSent += x;
+       }
+       
+       public synchronized long getPingSentBytes() {
+               return pingBytesSent;
+       }
+
+       public ByteCounter sskRequestCtr = new ByteCounter() {
+
+               public void receivedBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               sskRequestRcvdBytes += x;
+                       }
+               }
+
+               public void sentBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               sskRequestSentBytes += x;
+                       }
+               }
+
+               public void sentPayload(int x) {
+                       synchronized(NodeStats.this) {
+                               sskRequestSentBytes += x;
+                       }
+               }
+               
+       };
+       
+       public ByteCounter chkRequestCtr = new ByteCounter() {
+
+               public void receivedBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               chkRequestRcvdBytes += x;
+                       }
+               }
+
+               public void sentBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               chkRequestSentBytes += x;
+                       }
+               }
+
+               public void sentPayload(int x) {
+                       synchronized(NodeStats.this) {
+                               chkRequestSentBytes += x;
+                       }
+               }
+               
+       };
+       
+       public ByteCounter sskInsertCtr = new ByteCounter() {
+
+               public void receivedBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               sskInsertRcvdBytes += x;
+                       }
+               }
+
+               public void sentBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               sskInsertSentBytes += x;
+                       }
+               }
+
+               public void sentPayload(int x) {
+                       synchronized(NodeStats.this) {
+                               sskInsertSentBytes += x;
+                       }
+               }
+               
+       };
+       
+       public ByteCounter chkInsertCtr = new ByteCounter() {
+
+               public void receivedBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               chkInsertRcvdBytes += x;
+                       }
+               }
+
+               public void sentBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               chkInsertSentBytes += x;
+                       }
+               }
+
+               public void sentPayload(int x) {
+                       synchronized(NodeStats.this) {
+                               chkInsertSentBytes += x;
+                       }
+               }
+               
+       };
+       
+       private long probeRequestSentBytes;
+       private long probeRequestRcvdBytes;
+       
+       public ByteCounter probeRequestCtr = new ByteCounter() {
+
+               public void receivedBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               probeRequestRcvdBytes += x;
+                       }
+               }
+
+               public void sentBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               probeRequestSentBytes += x;
+                       }
+               }
+
+               public void sentPayload(int x) {
+                       synchronized(NodeStats.this) {
+                               probeRequestSentBytes += x;
+                       }
+               }
+               
+       };
+
+       public synchronized long getProbeRequestSentBytes() {
+               return probeRequestSentBytes;
+       }
+       
+       private long routedMessageBytesRcvd;
+       private long routedMessageBytesSent;
+       
+       public ByteCounter routedMessageCtr = new ByteCounter() {
+
+               public void receivedBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               routedMessageBytesRcvd += x;
+                       }
+               }
+
+               public void sentBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               routedMessageBytesSent += x;
+                       }
+               }
+
+               public void sentPayload(int x) {
+                       synchronized(NodeStats.this) {
+                               routedMessageBytesSent += x;
+                       }
+               }
+               
+       };
+       
+       public synchronized long getRoutedMessageSentBytes() {
+               return routedMessageBytesSent;
+       }
+       
+       private long disconnBytesReceived;
+       private long disconnBytesSent;
+
+       void disconnBytesReceived(int x) {
+               this.disconnBytesReceived += x;
+       }
+
+       void disconnBytesSent(int x) {
+               this.disconnBytesSent += x;
+       }
+       
+       public long getDisconnBytesSent() {
+               return disconnBytesSent;
+       }
+       
+       private long initialMessagesBytesReceived;
+       private long initialMessagesBytesSent;
+       
+       ByteCounter initialMessagesCtr = new ByteCounter() {
+
+               public void receivedBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               initialMessagesBytesReceived += x;
+                       }
+               }
+
+               public void sentBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               initialMessagesBytesSent += x;
+                       }
+               }
+
+               public void sentPayload(int x) {
+                       synchronized(NodeStats.this) {
+                               initialMessagesBytesSent += x;
+                       }
+               }
+               
+       };
+       
+       public synchronized long getInitialMessagesBytesSent() {
+               return initialMessagesBytesSent;
+       }
+       
+       private long changedIPBytesReceived;
+       private long changedIPBytesSent;
+       
+       ByteCounter changedIPCtr = new ByteCounter() {
+
+               public void receivedBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               changedIPBytesReceived += x;
+                       }
+               }
+
+               public void sentBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               changedIPBytesSent += x;
+                       }
+               }
+
+               public void sentPayload(int x) {
+                       synchronized(NodeStats.this) {
+                               changedIPBytesSent += x;
+                       }
+               }
+               
+       };
+
+       public long getChangedIPBytesSent() {
+               return changedIPBytesSent;
+       }
+       
+       private long nodeToNodeRcvdBytes;
+       private long nodeToNodeSentBytes;
+       
+       final ByteCounter nodeToNodeCounter = new ByteCounter() {
+
+               public void receivedBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               nodeToNodeRcvdBytes += x;
+                       }
+               }
+
+               public void sentBytes(int x) {
+                       synchronized(NodeStats.this) {
+                               nodeToNodeSentBytes += x;
+                       }
+               }
+
+               public void sentPayload(int x) {
+                       synchronized(NodeStats.this) {
+                               nodeToNodeSentBytes += x;
+                       }
+               }
+               
+       };
+       
+       public long getNodeToNodeBytesSent() {
+               return nodeToNodeSentBytes;
+       }
+       
 }

Modified: trunk/freenet/src/freenet/node/PeerManager.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerManager.java     2008-03-06 15:52:16 UTC 
(rev 18393)
+++ trunk/freenet/src/freenet/node/PeerManager.java     2008-03-06 15:52:43 UTC 
(rev 18394)
@@ -488,7 +488,7 @@
                                        if(removePeer(pn))
                                                writePeers();
                                        }
-                               }, 0, null);
+                               }, 0, ctrDisconn);
                        } catch (NotConnectedException e) {
                        if(pn.isDisconnecting() && removePeer(pn))
                                writePeers();
@@ -506,6 +506,22 @@
        }
     }

+    private final ByteCounter ctrDisconn = new ByteCounter() {
+
+               public void receivedBytes(int x) {
+                       node.nodeStats.disconnBytesReceived(x);
+               }
+
+               public void sentBytes(int x) {
+                       node.nodeStats.disconnBytesSent(x);
+               }
+
+               public void sentPayload(int x) {
+                       node.nodeStats.disconnBytesSent(x);
+               }
+       
+    };
+    
     protected static class LocationUIDPair implements Comparable {
        double location;
        long uid;

Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java        2008-03-06 15:52:16 UTC 
(rev 18393)
+++ trunk/freenet/src/freenet/node/PeerNode.java        2008-03-06 15:52:43 UTC 
(rev 18394)
@@ -962,6 +962,8 @@
        * throttle it).
        */
        public void sendAsync(Message msg, AsyncMessageCallback cb, int 
alreadyReportedBytes, ByteCounter ctr) throws NotConnectedException {
+               if(ctr == null)
+                       Logger.error(this, "Bytes not logged", new 
Exception("debug"));
                if(logMINOR)
                        Logger.minor(this, "Sending async: " + msg + " : " + cb 
+ " on " + this+" for "+node.getDarknetPortNumber());
                if(!isConnected())
@@ -1922,11 +1924,11 @@

                try {
                        if(isRealConnection())
-                               sendAsync(locMsg, null, 0, null);
-                       sendAsync(ipMsg, null, 0, null);
-                       sendAsync(timeMsg, null, 0, null);
-                       sendAsync(packetsMsg, null, 0, null);
-                       sendAsync(dRouting, null, 0, null);
+                               sendAsync(locMsg, null, 0, 
node.nodeStats.initialMessagesCtr);
+                       sendAsync(ipMsg, null, 0, 
node.nodeStats.initialMessagesCtr);
+                       sendAsync(timeMsg, null, 0, 
node.nodeStats.initialMessagesCtr);
+                       sendAsync(packetsMsg, null, 0, 
node.nodeStats.initialMessagesCtr);
+                       sendAsync(dRouting, null, 0, 
node.nodeStats.initialMessagesCtr);
                } catch(NotConnectedException e) {
                        Logger.error(this, "Completed handshake with " + 
getPeer() + " but disconnected (" + isConnected + ':' + currentTracker + "!!!: 
" + e, e);
                }
@@ -1965,7 +1967,7 @@
        private void sendIPAddressMessage() {
                Message ipMsg = DMT.createFNPDetectedIPAddress(detectedPeer);
                try {
-                       sendAsync(ipMsg, null, 0, null);
+                       sendAsync(ipMsg, null, 0, node.nodeStats.changedIPCtr);
                } catch(NotConnectedException e) {
                        Logger.normal(this, "Sending IP change message to " + 
this + " but disconnected: " + e, e);
                }
@@ -3111,7 +3113,7 @@
                byte[] authenticator = 
HMAC.macWithSHA256(node.failureTable.offerAuthenticatorKey, keyBytes, 32);
                Message msg = DMT.createFNPOfferKey(key, authenticator);
                try {
-                       sendAsync(msg, null, 0, null);
+                       sendAsync(msg, null, 0, node.nodeStats.sendOffersCtr);
                } catch(NotConnectedException e) {
                // Ignore
                }
@@ -3526,7 +3528,7 @@
                        n2nm = DMT.createNodeToNodeMessage(
                                        n2nType, 
fs.toString().getBytes("UTF-8"));
                        try {
-                               sendAsync(n2nm, null, 0, null);
+                               sendAsync(n2nm, null, 0, 
node.nodeStats.nodeToNodeCounter);
                        } catch (NotConnectedException e) {
                                if(includeSentTime) {
                                        fs.removeValue("sentTime");
@@ -3601,9 +3603,9 @@
                }
        }

-       void sendFNPNetworkID() throws NotConnectedException {
+       void sendFNPNetworkID(ByteCounter ctr) throws NotConnectedException {
                if (assignedNetworkID!=0)
-                       sendAsync(DMT.createFNPNetworkID(assignedNetworkID), 
null, 0, null);
+                       sendAsync(DMT.createFNPNetworkID(assignedNetworkID), 
null, 0, ctr);
        }

        public boolean isLocalAddress() {

Modified: trunk/freenet/src/freenet/node/SendMessageOnErrorCallback.java
===================================================================
--- trunk/freenet/src/freenet/node/SendMessageOnErrorCallback.java      
2008-03-06 15:52:16 UTC (rev 18393)
+++ trunk/freenet/src/freenet/node/SendMessageOnErrorCallback.java      
2008-03-06 15:52:43 UTC (rev 18394)
@@ -4,6 +4,7 @@
 package freenet.node;

 import freenet.io.comm.AsyncMessageCallback;
+import freenet.io.comm.ByteCounter;
 import freenet.io.comm.Message;
 import freenet.io.comm.NotConnectedException;
 import freenet.support.Logger;
@@ -20,10 +21,12 @@

     Message msg;
     PeerNode dest;
+    ByteCounter ctr;

-    public SendMessageOnErrorCallback(Message message, PeerNode pn) {
+    public SendMessageOnErrorCallback(Message message, PeerNode pn, 
ByteCounter ctr) {
         this.msg = message;
         this.dest = pn;
+        this.ctr = ctr;
         if(Logger.shouldLog(Logger.MINOR, this))
                Logger.minor(this, "Created "+this);
     }
@@ -40,7 +43,7 @@
        if(Logger.shouldLog(Logger.MINOR, this))
                Logger.minor(this, "Disconnect trigger: "+this);
         try {
-            dest.sendAsync(msg, null, 0, null);
+            dest.sendAsync(msg, null, 0, ctr);
         } catch (NotConnectedException e) {
                if(Logger.shouldLog(Logger.MINOR, this))
                        Logger.minor(this, "Both source and destination 
disconnected: "+msg+" for "+this);

Modified: trunk/freenet/src/freenet/node/updater/UpdateOverMandatoryManager.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/UpdateOverMandatoryManager.java      
2008-03-06 15:52:16 UTC (rev 18393)
+++ trunk/freenet/src/freenet/node/updater/UpdateOverMandatoryManager.java      
2008-03-06 15:52:43 UTC (rev 18394)
@@ -822,7 +822,7 @@
        private void cancelSend(PeerNode source, long uid) {
                Message msg = DMT.createFNPBulkReceiveAborted(uid);
                try {
-                       source.sendAsync(msg, null, 0, null);
+                       source.sendAsync(msg, null, 0, updateManager.ctr);
                } catch (NotConnectedException e1) {
                        // Ignore
                }


Reply via email to