Revert fix, suggestion was incorrect and can lead to memory leaks
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 30 Oct 2006 16:15:35 +0000 (16:15 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 30 Oct 2006 16:15:35 +0000 (16:15 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@469178 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/tomcat/util/net/NioEndpoint.java

index efc75e8..e550388 100644 (file)
@@ -1432,11 +1432,13 @@ public class NioEndpoint {
                             
                         }
                     } else {
+                        
                         NioChannel socket = (NioChannel)channel;
+
                         SelectionKey key = socket.getIOChannel().keyFor(socket.getPoller().getSelector());
                         int handshake = -1;
                         try {
-                            handshake = key!=null?socket.handshake(key.isReadable(), key.isWritable()):-1;
+                            handshake = socket.handshake(key.isReadable(), key.isWritable());
                         }catch ( IOException x ) {
                             handshake = -1;
                             if ( log.isDebugEnabled() ) log.debug("Error during SSL handshake",x);
@@ -1469,7 +1471,7 @@ public class NioEndpoint {
                                 }
                             }
                         } else if (handshake == -1 ) {
-                            if ( key.isValid() ) key.cancel();
+                            socket.getPoller().cancelledKey(key,SocketStatus.DISCONNECT);
                             try {socket.close(true);}catch (IOException ignore){}
                             nioChannels.offer(socket);
                         } else {