harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ch...@apache.org
Subject svn commit: r1025578 - in /harmony/enhanced/java/trunk/classlib/modules/nio/src: main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SelectorTest.java
Date Wed, 20 Oct 2010 13:51:56 GMT
Author: chope
Date: Wed Oct 20 13:51:56 2010
New Revision: 1025578

URL: http://svn.apache.org/viewvc?rev=1025578&view=rev
Log:
Back-out part of change from revision 1002476 (fix for HARMONY-6638) that checks if the key
is connected before OP_CONNECT is added to the list of selected keys.  Adding a test that
registers an OP_CONNECT key on a socket channel, connects and then checks there's a key in
the selectedKeys() list passes on the RI (also removing the check doesn't cause the regression
test that was added for 1002376 to fail).

Modified:
    harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java
    harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SelectorTest.java

Modified: harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java?rev=1025578&r1=1025577&r2=1025578&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java
Wed Oct 20 13:51:56 2010
@@ -560,11 +560,7 @@ final class SelectorImpl extends Abstrac
                     selectedOp = ACCEPT_OR_READ & ops;
                     break;
                 case WRITEABLE:
-                    if (key.isConnected()) {
-                        selectedOp = OP_WRITE & ops;
-                    } else {
-                        selectedOp = (OP_CONNECT | OP_WRITE) & ops;
-                    }
+                    selectedOp = (OP_CONNECT | OP_WRITE) & ops;
                     break;
             }
 

Modified: harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SelectorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SelectorTest.java?rev=1025578&r1=1025577&r2=1025578&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SelectorTest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SelectorTest.java
Wed Oct 20 13:51:56 2010
@@ -449,6 +449,22 @@ public class SelectorTest extends TestCa
         }
     }
 
+    public void test_nonBlockingConnect() throws IOException {
+        SocketChannel channel = null;
+        try {
+            channel = SocketChannel.open();
+            channel.configureBlocking(false);
+            Selector selector = Selector.open();
+            channel.register(selector, SelectionKey.OP_CONNECT);
+            channel.connect(LOCAL_ADDRESS);
+            channel.finishConnect();
+            selector.select();
+            assertEquals(1, selector.selectedKeys().size());
+        } finally {
+            channel.close();
+        }
+    }
+
     private void assert_select_SelectorClosed(SelectType type, int timeout)
             throws IOException {
         // selector is closed



Mime
View raw message