directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r158860 - in directory/network/trunk/src/java/org/apache/mina/io: datagram/DatagramAcceptor.java socket/SocketAcceptor.java
Date Thu, 24 Mar 2005 02:16:01 GMT
Author: trustin
Date: Wed Mar 23 18:15:59 2005
New Revision: 158860

URL: http://svn.apache.org/viewcvs?view=rev&rev=158860
Log:
Fixed: Acceptor.unbind() blocks forever if user tried to unbind unbound address.

Modified:
    directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
    directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java

Modified: directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java?view=diff&r1=158859&r2=158860
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java Wed
Mar 23 18:15:59 2005
@@ -460,25 +460,21 @@
             }
 
             DatagramChannel ch = ( DatagramChannel ) channels.get( request.address );
-            if( ch == null )
+            // close the channel
+            try
             {
-                synchronized( request )
+                if( ch == null )
                 {
-                    request.done = true;
                     request.exception = new IllegalArgumentException(
                             "Address not bound: " + request.address );
                 }
-                continue;
-            }
-            
-            SelectionKey key = ch.keyFor( selector );
-            key.cancel();
-            selector.wakeup(); // wake up again to trigger thread death
-            
-            // close the channel
-            try
-            {
-                ch.close();
+                else
+                {
+                    SelectionKey key = ch.keyFor( selector );
+                    key.cancel();
+                    selector.wakeup(); // wake up again to trigger thread death
+                    ch.close();
+                }
             }
             catch( IOException e )
             {

Modified: directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java?view=diff&r1=158859&r2=158860
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java Wed Mar
23 18:15:59 2005
@@ -317,25 +317,22 @@
             }
 
             ServerSocketChannel ssc = ( ServerSocketChannel ) channels.get( request.address
);
-            if( ssc == null )
+            
+            // close the channel
+            try
             {
-                synchronized( request )
+                if( ssc == null )
                 {
-                    request.done = true;
                     request.exception = new IllegalArgumentException(
                             "Address not bound: " + request.address );
                 }
-                continue;
-            }
-            
-            SelectionKey key = ssc.keyFor( selector );
-            key.cancel();
-            selector.wakeup(); // wake up again to trigger thread death
-            
-            // close the channel
-            try
-            {
-                ssc.close();
+                else
+                {
+                    SelectionKey key = ssc.keyFor( selector );
+                    key.cancel();
+                    selector.wakeup(); // wake up again to trigger thread death
+                    ssc.close();
+                }
             }
             catch( IOException e )
             {



Mime
View raw message