Author: j16sdiz
Date: 2008-11-07 03:43:25 +0000 (Fri, 07 Nov 2008)
New Revision: 23372

Modified:
   trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
   trunk/freenet/src/freenet/node/NodeStats.java
Log:
nodestat: synchronization, access to long are not atomic

Modified: trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java     2008-11-07 
00:38:25 UTC (rev 23371)
+++ trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java     2008-11-07 
03:43:25 UTC (rev 23372)
@@ -202,7 +202,7 @@
                try {
                        _sock.receive(packet);
                        collector.addInfo(packet.getAddress() + ":" + 
packet.getPort(),
-                                       packet.getLength(), 0);
+                                       packet.getLength(), 0); // FIXME use 
(packet.getLength() + UDP_HEADERS_LENGTH)?
                } catch (SocketTimeoutException e1) {
                        return false;
                } catch (IOException e2) {

Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java       2008-11-07 00:38:25 UTC 
(rev 23371)
+++ trunk/freenet/src/freenet/node/NodeStats.java       2008-11-07 03:43:25 UTC 
(rev 23372)
@@ -1213,19 +1213,19 @@
                        chkInsertRcvdBytes += x;
        }

-       public long getCHKRequestTotalBytesSent() {
+       public synchronized long getCHKRequestTotalBytesSent() {
                return chkRequestSentBytes;
        }

-       public long getSSKRequestTotalBytesSent() {
+       public synchronized long getSSKRequestTotalBytesSent() {
                return sskRequestSentBytes;
        }

-       public long getCHKInsertTotalBytesSent() {
+       public synchronized long getCHKInsertTotalBytesSent() {
                return chkInsertSentBytes;
        }

-       public long getSSKInsertTotalBytesSent() {
+       public synchronized long getSSKInsertTotalBytesSent() {
                return sskInsertSentBytes;
        }

@@ -1289,11 +1289,11 @@
                swappingSentBytes += x;
        }

-       public long getSwappingTotalBytesReceived() {
+       public synchronized long getSwappingTotalBytesReceived() {
                return swappingRcvdBytes;
        }

-       public long getSwappingTotalBytesSent() {
+       public synchronized long getSwappingTotalBytesSent() {
                return swappingSentBytes;
        }

@@ -1303,7 +1303,7 @@
                totalAuthBytesSent += x;
        }

-       public long getTotalAuthBytesSent() {
+       public synchronized long getTotalAuthBytesSent() {
                return totalAuthBytesSent;
        }

@@ -1327,7 +1327,7 @@

        };

-       public long getResendBytesSent() {
+       public synchronized long getResendBytesSent() {
                return resendBytesSent;
        }

@@ -1337,7 +1337,7 @@
                uomBytesSent += x;
        }

-       public long getUOMBytesSent() {
+       public synchronized long getUOMBytesSent() {
                return uomBytesSent;
        }

@@ -1364,7 +1364,7 @@

        };

-       public long getAnnounceBytesSent() {
+       public synchronized long getAnnounceBytesSent() {
                return announceBytesSent;
        }

@@ -1663,7 +1663,7 @@
                return notificationOnlySentBytes;
        }

-       public long getSentOverhead() {
+       public synchronized long getSentOverhead() {
                return offerKeysSentBytes // offers we have sent
                + swappingSentBytes // swapping
                + totalAuthBytesSent // connection setup


Reply via email to