Author: markt Date: Mon Mar 11 14:58:54 2013 New Revision: 1455167 URL: http://svn.apache.org/r1455167 Log: Fix upgraded connections (i.e. WebSocket) and SSL for the NIO connector
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1455167&r1=1455166&r2=1455167&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Mon Mar 11 14:58:54 2013 @@ -1548,7 +1548,22 @@ public class NioEndpoint extends Abstrac int handshake = -1; try { - if (key!=null) handshake = socket.handshake(key.isReadable(), key.isWritable()); + if (key != null) { + if (socket.isHandshakeComplete()) { + handshake = 0; + } else { + handshake = socket.handshake( + key.isReadable(), key.isWritable()); + // The handshake process reads/writes from/to the + // socket. status may therefore be OPEN_WRITE once + // the handshake completes. However, the handshake + // happens when the socket is opened so the status + // must always be OPEN_READ after it completes. It + // is OK to always set this as it is only used if + // the handshake completes. + status = SocketStatus.OPEN_READ; + } + } }catch ( IOException x ) { handshake = -1; if ( log.isDebugEnabled() ) log.debug("Error during SSL handshake",x); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org