Author: toad
Date: 2008-03-01 20:23:07 +0000 (Sat, 01 Mar 2008)
New Revision: 18297

Modified:
   trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
Log:
Don't log packets to the overall Total Bandwidth if we fail to send them e.g. 
due to IPv6 being disabled.

Modified: trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java     2008-03-01 
20:08:33 UTC (rev 18296)
+++ trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java     2008-03-01 
20:23:07 UTC (rev 18297)
@@ -247,13 +247,11 @@
                packet.setAddress(address);
                packet.setPort(port);

-               // TODO: keep?
-               // packet.length() is simply the size of the buffer, it knows 
nothing of UDP headers
-               IOStatisticCollector.addInfo(address + ":" + port, 0, 
blockToSend.length + UDP_HEADERS_LENGTH); 
-               tracker.sentPacketTo(destination);

                try {
                        _sock.send(packet);
+                       tracker.sentPacketTo(destination);
+                       IOStatisticCollector.addInfo(address + ":" + port, 0, 
blockToSend.length + UDP_HEADERS_LENGTH); 
                        if(logMINOR) Logger.minor(this, "Sent packet length 
"+blockToSend.length+" to "+address);
                } catch (IOException e) {
                        if(packet.getAddress() instanceof Inet6Address)


Reply via email to