Author: toad
Date: 2008-03-25 18:12:44 +0000 (Tue, 25 Mar 2008)
New Revision: 18789

Modified:
   trunk/freenet/src/freenet/io/comm/ByteCounter.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/ResettingHTLProbeRequestSender.java
   trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java
Log:
Fix the negative Other Output bug: fix doublecounting in various 
sentPayload()'s, some of which (UOM) actually happen and occasionally cause 
major problems (whole node stops working type of problems, caused by the node 
thinking it's using all its bandwidth for UOM...).

Modified: trunk/freenet/src/freenet/io/comm/ByteCounter.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/ByteCounter.java  2008-03-25 16:34:55 UTC 
(rev 18788)
+++ trunk/freenet/src/freenet/io/comm/ByteCounter.java  2008-03-25 18:12:44 UTC 
(rev 18789)
@@ -13,7 +13,11 @@

        public void receivedBytes(int x);

-       /** Sent payload - only include the number of bytes of actual payload 
i.e. data from the user's point of view, as opposed to overhead. */
+       /** Sent payload - only include the number of bytes of actual payload 
i.e. data from 
+        * the user's point of view, as opposed to overhead.
+        *  
+        * IMPORTANT: This will also be reported to sentBytes()! DO NOT ADD the 
total from sentBytes() 
+        * to the total from sentPayloadBytes(), or you will double-count. */
        public void sentPayload(int x);

 }

Modified: trunk/freenet/src/freenet/node/NetworkIDManager.java
===================================================================
--- trunk/freenet/src/freenet/node/NetworkIDManager.java        2008-03-25 
16:34:55 UTC (rev 18788)
+++ trunk/freenet/src/freenet/node/NetworkIDManager.java        2008-03-25 
18:12:44 UTC (rev 18789)
@@ -1023,7 +1023,7 @@
                }

                public void sentPayload(int x) {
-                       node.nodeStats.networkColoringSentBytes(x);
+                       // Ignore
                }

        };

Modified: trunk/freenet/src/freenet/node/NodeDispatcher.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeDispatcher.java  2008-03-25 16:34:55 UTC 
(rev 18788)
+++ trunk/freenet/src/freenet/node/NodeDispatcher.java  2008-03-25 18:12:44 UTC 
(rev 18789)
@@ -64,7 +64,7 @@
                }

                public void sentPayload(int x) {
-                       node.nodeStats.pingCounterSent(x);
+                       // Ignore
                }

        };

Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java       2008-03-25 16:34:55 UTC 
(rev 18788)
+++ trunk/freenet/src/freenet/node/NodeStats.java       2008-03-25 18:12:44 UTC 
(rev 18789)
@@ -1158,9 +1158,7 @@
                }

                public void sentPayload(int x) {
-                       synchronized(NodeStats.this) {
-                               offerKeysSentBytes += x;
-                       }
+                       // Ignore
                }

        };
@@ -1214,9 +1212,6 @@

                public void sentPayload(int x) {
                        Logger.error(this, "Payload sent in 
resendByteCounter????", new Exception("error"));
-                       synchronized(NodeStats.this) {
-                               resendBytesSent += x;
-                       }
                }

        };
@@ -1253,9 +1248,7 @@
                }

                public void sentPayload(int x) {
-                       synchronized(NodeStats.this) {
-                               announceBytesSent += x;
-                       }
+                       // Ignore
                }

        };
@@ -1280,9 +1273,7 @@
                }

                public void sentPayload(int x) {
-                       synchronized(NodeStats.this) {
-                               routingStatusBytesSent += x;
-                       }
+                       // Ignore
                }

        };
@@ -1336,9 +1327,7 @@
                }

                public void sentPayload(int x) {
-                       synchronized(NodeStats.this) {
-                               sskRequestSentBytes += x;
-                       }
+                       // Ignore
                }

        };
@@ -1358,9 +1347,7 @@
                }

                public void sentPayload(int x) {
-                       synchronized(NodeStats.this) {
-                               chkRequestSentBytes += x;
-                       }
+                       // Ignore
                }

        };
@@ -1380,9 +1367,7 @@
                }

                public void sentPayload(int x) {
-                       synchronized(NodeStats.this) {
-                               sskInsertSentBytes += x;
-                       }
+                       // Ignore
                }

        };
@@ -1402,9 +1387,7 @@
                }

                public void sentPayload(int x) {
-                       synchronized(NodeStats.this) {
-                               chkInsertSentBytes += x;
-                       }
+                       // Ignore
                }

        };
@@ -1427,9 +1410,7 @@
                }

                public void sentPayload(int x) {
-                       synchronized(NodeStats.this) {
-                               probeRequestSentBytes += x;
-                       }
+                       // Ignore
                }

        };
@@ -1456,9 +1437,7 @@
                }

                public void sentPayload(int x) {
-                       synchronized(NodeStats.this) {
-                               routedMessageBytesSent += x;
-                       }
+                       // Ignore
                }

        };
@@ -1500,9 +1479,7 @@
                }

                public void sentPayload(int x) {
-                       synchronized(NodeStats.this) {
-                               initialMessagesBytesSent += x;
-                       }
+                       // Ignore
                }

        };
@@ -1529,9 +1506,7 @@
                }

                public void sentPayload(int x) {
-                       synchronized(NodeStats.this) {
-                               changedIPBytesSent += x;
-                       }
+                       // Ignore
                }

        };
@@ -1558,9 +1533,7 @@
                }

                public void sentPayload(int x) {
-                       synchronized(NodeStats.this) {
-                               nodeToNodeSentBytes += x;
-                       }
+                       // Ignore
                }

        };

Modified: trunk/freenet/src/freenet/node/PeerManager.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerManager.java     2008-03-25 16:34:55 UTC 
(rev 18788)
+++ trunk/freenet/src/freenet/node/PeerManager.java     2008-03-25 18:12:44 UTC 
(rev 18789)
@@ -525,7 +525,7 @@
                }

                public void sentPayload(int x) {
-                       node.nodeStats.disconnBytesSent(x);
+                       // Ignore
                }

     };

Modified: trunk/freenet/src/freenet/node/ResettingHTLProbeRequestSender.java
===================================================================
--- trunk/freenet/src/freenet/node/ResettingHTLProbeRequestSender.java  
2008-03-25 16:34:55 UTC (rev 18788)
+++ trunk/freenet/src/freenet/node/ResettingHTLProbeRequestSender.java  
2008-03-25 18:12:44 UTC (rev 18789)
@@ -449,8 +449,7 @@
        }

        public void sentPayload(int x) {
-               node.sentPayload(x);
-               node.nodeStats.probeRequestCtr.sentBytes(x);
+               Logger.error(this, "sentPayload("+x+") in 
ResettingHTLProbeRequestSender ?!?!? for "+this, new Exception("error"));
        }

        public boolean isLocalRequestSearch() {

Modified: trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java       
2008-03-25 16:34:55 UTC (rev 18788)
+++ trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java       
2008-03-25 18:12:44 UTC (rev 18789)
@@ -900,7 +900,7 @@
                }

                public void sentPayload(int x) {
-                       node.nodeStats.reportUOMBytesSent(x);
+                       // Ignore. It will be reported to sentBytes() as well.
                }

        };


Reply via email to