Author: markt Date: Tue Feb 28 11:02:21 2012 New Revision: 1294576 URL: http://svn.apache.org/viewvc?rev=1294576&view=rev Log: Re-factor to get NIO closer to working and with an eye on switching to non-blocking (where supported by the endpoint).
Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1294576&r1=1294575&r2=1294576&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Tue Feb 28 11:02:21 2012 @@ -563,7 +563,17 @@ public abstract class AbstractProtocol i if (state != SocketState.CLOSED && processor.isAsync()) { state = processor.asyncPostProcess(); } - } while (state == SocketState.ASYNC_END); + + if (state == SocketState.UPGRADING) { + // Get the UpgradeInbound handler + UpgradeInbound inbound = processor.getUpgradeInbound(); + // Release the Http11 processor to be re-used + release(socket, processor, false, false); + // Create the light-weight upgrade processor + processor = createUpgradeProcessor(socket, inbound); + } + } while (state == SocketState.ASYNC_END || + state == SocketState.UPGRADING); if (state == SocketState.LONG) { // In the middle of processing a request/response. Keep the @@ -582,15 +592,6 @@ public abstract class AbstractProtocol i } else if (state == SocketState.UPGRADED) { // Need to keep the connection associated with the processor upgradePoll(socket, processor); - } else if (state == SocketState.UPGRADING) { - // Get the UpgradeInbound handler - UpgradeInbound inbound = processor.getUpgradeInbound(); - // Release the Http11 processor to be re-used - release(socket, processor, false, false); - // Create the light-weight upgrade processor - processor = createUpgradeProcessor(socket, inbound); - // Need to keep the connection associated with the processor - upgradePoll(socket, processor); } else { // Connection closed. OK to recycle the processor. if (!(processor instanceof UpgradeProcessor)) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org