Author: nextgens
Date: 2007-02-25 18:03:25 +0000 (Sun, 25 Feb 2007)
New Revision: 11918
Modified:
trunk/freenet/src/freenet/io/comm/UdpSocketManager.java
trunk/freenet/src/freenet/node/NodeIPDetector.java
Log:
Make the node use the new code : we will use the lowest MTU reported on all
interfaces.
it might lead to some problems though :/
Modified: trunk/freenet/src/freenet/io/comm/UdpSocketManager.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/UdpSocketManager.java 2007-02-25
18:01:24 UTC (rev 11917)
+++ trunk/freenet/src/freenet/io/comm/UdpSocketManager.java 2007-02-25
18:03:25 UTC (rev 11918)
@@ -682,8 +682,12 @@
/**
* @return The maximum packet size supported by this SocketManager.
*/
- public int getMaxPacketSize() {
- return 1400-28; // CompuServe use 1400 MTU; AOL claim 1450; DFN at home
use 1448.
+ 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 maxAllowedMTU = 1400-28;
+
+ return minAdvertizedMTU < maxAllowedMTU ? minAdvertizedMTU :
maxAllowedMTU;
+ // 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
// http://www.studenten-ins-netz.net/inhalt/service_faq.html
Modified: trunk/freenet/src/freenet/node/NodeIPDetector.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeIPDetector.java 2007-02-25 18:01:24 UTC
(rev 11917)
+++ trunk/freenet/src/freenet/node/NodeIPDetector.java 2007-02-25 18:03:25 UTC
(rev 11918)
@@ -37,6 +37,8 @@
DetectedIP[] pluginDetectedIPs;
/** Last detected IP address */
Peer[] lastIPAddress;
+ /** The minimum reported MTU on all detected interfaces */
+ private int minimumMTU;
/** IP address detector */
private final IPAddressDetector ipDetector;
/** Plugin manager for plugin IP address detectors e.g. STUN */
@@ -260,6 +262,12 @@
*/
public void processDetectedIPs(DetectedIP[] list) {
pluginDetectedIPs = list;
+ for(int i=0; i<pluginDetectedIPs.length; i++){
+ if(minimumMTU > pluginDetectedIPs[i].mtu){
+ minimumMTU = pluginDetectedIPs[i].mtu;
+ Logger.normal(this, "Reducing the MTU to
"+minimumMTU);
+ }
+ }
redetectAddress();
arkPutter.update();
if(oldARKPutter != null)
@@ -422,5 +430,9 @@
hasDetectedPM = true;
}
}
+
+ public int getMinimumDetectedMTU() {
+ return minimumMTU;
+ }
}