Author: nextgens
Date: 2007-07-19 22:13:18 +0000 (Thu, 19 Jul 2007)
New Revision: 14197

Modified:
   trunk/freenet/src/freenet/node/Node.java
Log:
Restrict the length of the node name and simplify the logic in the callback. 
Long node names are bad... a too big noderef might lead to fragmented auth 
packets

Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java    2007-07-19 21:57:37 UTC (rev 
14196)
+++ trunk/freenet/src/freenet/node/Node.java    2007-07-19 22:13:18 UTC (rev 
14197)
@@ -128,14 +128,12 @@
                        }

                        public void set(String val) throws 
InvalidConfigValueException {
-                               if("".equals(val))
+                               if(get().equals(val)) return;
+                               else if(val.length() > 128)
+                                       throw new 
InvalidConfigValueException("The given node name is too long ("+val+')');
+                               else if("".equals(val))
                                        val = "~none~";
                                myName = val;
-                               if(myName.startsWith("Node id|")|| 
myName.equals("MyFirstFreenetNode")){
-                                       
clientCore.alerts.register(nodeNameUserAlert);
-                               }else{
-                                       
clientCore.alerts.unregister(nodeNameUserAlert);
-                               }
                        }
        }



Reply via email to