Author: toad
Date: 2008-04-19 17:04:56 +0000 (Sat, 19 Apr 2008)
New Revision: 19435

Modified:
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
   trunk/freenet/src/freenet/node/IPDetectorPluginManager.java
Log:
Tell the user immediately on detecting NO_UDP. Reuse the strings from the 
connectivity page, but new short version. Unregister as soon as we know (in 
IPDetectorPluginManager) that we do have UDP connectivity.

Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-04-19 
16:53:31 UTC (rev 19434)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-04-19 
17:04:56 UTC (rev 19435)
@@ -469,6 +469,7 @@
 IPDetectorPluginManager.fullConeTitle=Full cone NAT detected
 IPDetectorPluginManager.noConnectivity=Your internet connection does not 
appear to support UDP. Unless this detection is wrong, it is unlikely that 
Freenet will work on your computer at present.
 IPDetectorPluginManager.noConnectivityTitle=No UDP connectivity
+IPDetectorPluginManager.noConnectivityshort=Severe connection problems: No UDP 
connectivity, Freenet will not work!
 IPDetectorPluginManager.portRestricted=Your internet connection appears to be 
behind a port-restricted NAT (router). You will be able to connect to most 
other users, but not those behind symmetric NATs.
 IPDetectorPluginManager.portRestrictedTitle=Port restricted cone NAT detected
 IPDetectorPluginManager.restricted=Your internet connection appears to be 
behind a "restricted cone" NAT (router). You should be able to connect to most 
other users.

Modified: trunk/freenet/src/freenet/node/IPDetectorPluginManager.java
===================================================================
--- trunk/freenet/src/freenet/node/IPDetectorPluginManager.java 2008-04-19 
16:53:31 UTC (rev 19434)
+++ trunk/freenet/src/freenet/node/IPDetectorPluginManager.java 2008-04-19 
17:04:56 UTC (rev 19435)
@@ -15,6 +15,7 @@
 import freenet.l10n.L10n;
 import freenet.node.useralerts.AbstractUserAlert;
 import freenet.node.useralerts.ProxyUserAlert;
+import freenet.node.useralerts.SimpleUserAlert;
 import freenet.node.useralerts.UserAlert;
 import freenet.pluginmanager.DetectedIP;
 import freenet.pluginmanager.ForwardPort;
@@ -784,6 +785,24 @@
                                        proxyAlert.isValid(false);
                                }
                                detector.processDetectedIPs(list);
+                               if(connectionType == DetectedIP.NO_UDP) {
+                                       SimpleUserAlert toRegister = null;
+                                       synchronized(this) {
+                                               if(noConnectivityAlert == null)
+                                                       noConnectivityAlert = 
toRegister =
+                                                               new 
SimpleUserAlert(false, l10n("noConnectivityTitle"), l10n("noConnectivity"), 
l10n("noConnectivityShort"), UserAlert.ERROR);
+                                       }
+                                       if(toRegister != null)
+                                               
node.clientCore.alerts.register(toRegister);
+                               } else {
+                                       UserAlert toKill;
+                                       synchronized(this) {
+                                               toKill = noConnectivityAlert;
+                                               noConnectivityAlert = null;
+                                       }
+                                       if(toKill != null)
+                                               
node.clientCore.alerts.unregister(toKill);
+                               }
                        } finally {
                                synchronized(IPDetectorPluginManager.this) {
                                        runners.remove(plugin);
@@ -793,6 +812,8 @@
                }

        }
+       
+       private SimpleUserAlert noConnectivityAlert;

        public boolean isEmpty() {
                return plugins.length == 0;


Reply via email to