Author: j16sdiz
Date: 2009-04-20 01:46:25 +0000 (Mon, 20 Apr 2009)
New Revision: 27093

Modified:
   trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
Log:
Slient SocketException on shutdown (fix bug 2973)

Modified: trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java     2009-04-20 
01:14:04 UTC (rev 27092)
+++ trunk/freenet/src/freenet/io/comm/UdpSocketHandler.java     2009-04-20 
01:46:25 UTC (rev 27093)
@@ -198,7 +198,10 @@
                } catch (SocketTimeoutException e1) {
                        return false;
                } catch (IOException e2) {
-                       throw new RuntimeException(e2);
+                       if (!_active)   // closed, just return silently
+                               return false;
+                       else
+                               throw new RuntimeException(e2);
                }
                if(logMINOR) Logger.minor(this, "Received packet");
                return true;
@@ -299,9 +302,10 @@
 
     public void close() {
        Logger.normal(this, "Closing.", new Exception("error"));
-               _sock.close();
                synchronized (this) {
                        _active = false;
+                       _sock.close();
+
                        if(!_started) return;
                        while (!_isDone) {
                                try {

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to