Author: nextgens
Date: 2007-02-25 17:55:17 +0000 (Sun, 25 Feb 2007)
New Revision: 11916

Modified:
   trunk/freenet/src/freenet/pluginmanager/DetectedIP.java
   trunk/plugins/JSTUN/JSTUN.java
Log:
Make the JSTUN plugin report the interface MTU if known.

Modified: trunk/freenet/src/freenet/pluginmanager/DetectedIP.java
===================================================================
--- trunk/freenet/src/freenet/pluginmanager/DetectedIP.java     2007-02-25 
14:58:49 UTC (rev 11915)
+++ trunk/freenet/src/freenet/pluginmanager/DetectedIP.java     2007-02-25 
17:55:17 UTC (rev 11916)
@@ -17,6 +17,8 @@

        public final InetAddress publicAddress;
        public final short natType;
+       /** The MTU as advertized by the JVM */
+       public int mtu;
        // Constants
        /** The plugin does not support detecting the NAT type. */
        public static final short NOT_SUPPORTED = 1;
@@ -42,6 +44,7 @@
        public DetectedIP(InetAddress addr, short type) {
                this.publicAddress = addr;
                this.natType = type;
+               this.mtu = 1500;
        }

        public boolean equals(Object o) {

Modified: trunk/plugins/JSTUN/JSTUN.java
===================================================================
--- trunk/plugins/JSTUN/JSTUN.java      2007-02-25 14:58:49 UTC (rev 11915)
+++ trunk/plugins/JSTUN/JSTUN.java      2007-02-25 17:55:17 UTC (rev 11916)
@@ -154,6 +154,7 @@
                        DetectedIP ip;
                        try {
                                ip = runTest(startAddress);
+                               ip.mtu = 
NetworkInterface.getByInetAddress(startAddress).getMTU();
                        } catch (Throwable t) {
                                ip = null;
                                System.err.println("Caught "+t);


Reply via email to