Author: toad
Date: 2008-02-27 19:06:38 +0000 (Wed, 27 Feb 2008)
New Revision: 18187
Modified:
trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
trunk/freenet/src/freenet/node/Node.java
Log:
Warn the user via a useralert if their MTU is too low.
Modified: trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java 2008-02-27
18:54:58 UTC (rev 18186)
+++ trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java 2008-02-27
19:06:38 UTC (rev 18187)
@@ -276,12 +276,13 @@
/**
* @return The maximum packet size supported by this SocketManager, not
including transport (UDP/IP) headers.
*/
- public int getMaxPacketSize() { //FIXME: what about passing a peerNode
though and doing it on a per-peer basis?
+ public int getMaxPacketSize() { //FIXME: what about passing a peerNode
though and doing it on a per-peer basis? How? PMTU would require JNI, although
it might be worth it...
final int minAdvertisedMTU = node.ipDetector.getMinimumDetectedMTU();
// 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()+')');
+ Logger.error(this, "It shouldn't happen : we disabled the MTU
detection algorithm because the advertised MTU is smallish !!
("+node.ipDetector.getMinimumDetectedMTU()+')');
+ node.onTooLowMTU(minAdvertisedMTU, 1100);
return MAX_ALLOWED_MTU - UDP_HEADERS_LENGTH;
} else
return Math.min(MAX_ALLOWED_MTU, minAdvertisedMTU) -
UDP_HEADERS_LENGTH;
Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2008-02-27
18:54:58 UTC (rev 18186)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2008-02-27
19:06:38 UTC (rev 18187)
@@ -646,6 +646,8 @@
Node.storeTypeLong=Datastore type. Currently this can be bdb-index (use a
BerkeleyDBFreenetStore to store the index, and keep the data in files on disk),
or ram (keep the index and the data in RAM). Only use ram if you know what you
are doing and have enough RAM to store all your data (and note it will not be
saved on shutdown)!
Node.swapRInterval=Swap request send interval (ms)
Node.swapRIntervalLong=Interval between swap attempting to send swap requests
in milliseconds. Leave this alone!
+Node.tooSmallMTU=Too small MTU
+Node.tooSmallMTULong=Your connection's MTU appears to be ${mtu} bytes. Freenet
will not function well with an MTU of less than ${minMTU} bytes: connections
will be unreliable and possibly slow. Please fix the problem if possible.
NodeClientCore.couldNotFindOrCreateDir=Could not find or create directory
NodeClientCore.downloadAllowedDirs=Directories downloading is allowed to
NodeClientCore.downloadAllowedDirsLong=Semicolon separated list of directories
to which downloads are allowed. "downloads" means downloadsDir, empty means no
downloads to disk allowed, "all" means downloads allowed from anywhere.
WARNING! If this is set to "all" any user can download any file to anywhere on
your computer!
Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java 2008-02-27 18:54:58 UTC (rev
18186)
+++ trunk/freenet/src/freenet/node/Node.java 2008-02-27 19:06:38 UTC (rev
18187)
@@ -3270,4 +3270,13 @@
public boolean peersWantKey(Key key) {
return failureTable.peersWantKey(key);
}
+
+ private SimpleUserAlert alertMTUTooSmall;
+
+ public void onTooLowMTU(int minAdvertisedMTU, int minAcceptableMTU) {
+ if(alertMTUTooSmall == null) {
+ alertMTUTooSmall = new SimpleUserAlert(false,
l10n("tooSmallMTU"), l10n("tooSmallMTULong", new String[] { "mtu", "minMTU" },
new String[] { Integer.toString(minAdvertisedMTU),
Integer.toString(minAcceptableMTU) }), UserAlert.ERROR);
+ } else return;
+ clientCore.alerts.register(alertMTUTooSmall);
+ }
}