[freenet-cvs] r11990 - trunk/freenet/src/freenet/io/comm

nextgens at freenetproject.org nextgens at freenetproject.org
Tue Mar 6 01:34:43 UTC 2007


Author: nextgens
Date: 2007-03-06 01:26:32 +0000 (Tue, 06 Mar 2007)
New Revision: 11990

Modified:
   trunk/freenet/src/freenet/io/comm/UdpSocketManager.java
Log:
Add a minimum value for the "detectedMTU" and fix a typo.

Modified: trunk/freenet/src/freenet/io/comm/UdpSocketManager.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/UdpSocketManager.java	2007-03-06 01:11:37 UTC (rev 11989)
+++ trunk/freenet/src/freenet/io/comm/UdpSocketManager.java	2007-03-06 01:26:32 UTC (rev 11990)
@@ -683,11 +683,16 @@
      * @return The maximum packet size supported by this SocketManager.
      */
     public int getMaxPacketSize() { //FIXME: what about passing a peerNode though and doing it on a per-peer basis?
-    	final int minAdvertizedMTU = node.ipDetector.getMinimumDetectedMTU();
+    	final int minAdvertisedMTU = node.ipDetector.getMinimumDetectedMTU();
     	final int maxAllowedMTU = 1400;
-	final int overhead = 28;
+    	final int overhead = 28;
     	
-    	return (minAdvertizedMTU < maxAllowedMTU ? minAdvertizedMTU : maxAllowedMTU) - overhead;
+    	// We don't want the MTU detection thingy to prevent us to send PacketTransmits!
+    	if(minAdvertisedMTU < 1100){
+    		Logger.error(this, "It shouldn't happen : we disabled the MTU detection algorithm because the advertised MTU is smallish !! ("+node.ipDetector.getMinimumDetectedMTU()+')'); 
+    		return maxAllowedMTU - overhead;
+    	}else
+    		return (minAdvertisedMTU < maxAllowedMTU ? minAdvertisedMTU : maxAllowedMTU) - overhead;
     	// CompuServe use 1400 MTU; AOL claim 1450; DFN at home use 1448.
     	// http://info.aol.co.uk/broadband/faqHomeNetworking.adp
     	// http://www.compuserve.de/cso/hilfe/linux/hilfekategorien/installation/contentview.jsp?conid=385700




More information about the cvs mailing list