Author: toad
Date: 2007-07-03 13:31:24 +0000 (Tue, 03 Jul 2007)
New Revision: 13890

Modified:
   trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
Log:
Don't crash on a normal completion (e.g. turning opennet off)

Modified: trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java     2007-07-03 
13:30:16 UTC (rev 13889)
+++ trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java     2007-07-03 
13:31:24 UTC (rev 13890)
@@ -102,8 +102,8 @@
                                t.printStackTrace();
                        } catch (Throwable tt) {};
                } finally {
-                       System.err.println("run() exiting");
-                       Logger.error(this, "run() exiting");
+                       System.err.println("run() exiting for UdpSocketHandler 
on port "+_sock.getLocalPort());
+                       Logger.error(this, "run() exiting for UdpSocketHandler 
on port "+_sock.getLocalPort());
                        synchronized (this) {
                                _isDone = true;
                                notifyAll();
@@ -319,6 +319,11 @@
                                                }
                                        }
                                } else {
+                                       if(_isDone) return;
+                                       // Final check
+                                       synchronized(this) {
+                                               if(_isDone) return;
+                                       }
                                        Logger.error(this, "MAIN LOOP 
TERMINATED");
                                        System.err.println("MAIN LOOP 
TERMINATED!");
                                        
node.exit(NodeInitException.EXIT_MAIN_LOOP_LOST);


Reply via email to