Author: nextgens
Date: 2008-09-28 18:25:27 +0000 (Sun, 28 Sep 2008)
New Revision: 22881

Modified:
   trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
Log:
Don't fill in the logfiles/disks if MTU is too small

Modified: trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java     2008-09-28 
13:51:13 UTC (rev 22880)
+++ trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java     2008-09-28 
18:25:27 UTC (rev 22881)
@@ -272,6 +272,7 @@
     public static final int UDP_HEADERS_LENGTH = 28;

     public static final int MIN_MTU = 1100;
+    private volatile boolean disableMTUDetection = false;

     /**
      * @return The maximum packet size supported by this SocketManager, not 
including transport (UDP/IP) headers.
@@ -280,8 +281,11 @@
        final int minAdvertisedMTU = node.ipDetector.getMinimumDetectedMTU();

        // We don't want the MTU detection thingy to prevent us to send 
PacketTransmits!
-       if(minAdvertisedMTU < MIN_MTU){
-               Logger.error(this, "It shouldn't happen : we disabled the MTU 
detection algorithm because the advertised MTU is smallish !! 
("+node.ipDetector.getMinimumDetectedMTU()+')');
+       if(disableMTUDetection || minAdvertisedMTU < MIN_MTU){
+               if(!disableMTUDetection) {
+                       Logger.error(this, "It shouldn't happen : we disabled 
the MTU detection algorithm because the advertised MTU is smallish !! 
("+node.ipDetector.getMinimumDetectedMTU()+')');
+                       disableMTUDetection = true;
+               }
                return MAX_ALLOWED_MTU - UDP_HEADERS_LENGTH;
        } else
                return Math.min(MAX_ALLOWED_MTU, minAdvertisedMTU) - 
UDP_HEADERS_LENGTH;


Reply via email to