From 404626b18ca7e8ba9228202824806adbc963d8e5 Mon Sep 17 00:00:00 2001 From: fhanik Date: Mon, 30 Oct 2006 15:53:19 +0000 Subject: [PATCH] If the key is null, channel is closed,not sure this is the correct fix, since the key potentially had an attachment this could lead to NIO mem leak, must track down how this happens git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@469168 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/tomcat/util/net/NioEndpoint.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index 4c7a4a581..efc75e85a 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -1432,13 +1432,11 @@ public class NioEndpoint { } } else { - NioChannel socket = (NioChannel)channel; - SelectionKey key = socket.getIOChannel().keyFor(socket.getPoller().getSelector()); int handshake = -1; try { - handshake = socket.handshake(key.isReadable(), key.isWritable()); + handshake = key!=null?socket.handshake(key.isReadable(), key.isWritable()):-1; }catch ( IOException x ) { handshake = -1; if ( log.isDebugEnabled() ) log.debug("Error during SSL handshake",x); -- 2.11.0