Author: markt Date: Thu May 5 15:11:18 2011 New Revision: 1099838 URL: http://svn.apache.org/viewvc?rev=1099838&view=rev Log: Simplify the keep-alive tracking and fix a couple of issues with the keep-alive disable code
Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java?rev=1099838&r1=1099837&r2=1099838&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java Thu May 5 15:11:18 2011 @@ -183,7 +183,9 @@ public class Http11Processor extends Abs error = false; keepAlive = true; - int keepAliveLeft = maxKeepAliveRequests>0?socketWrapper.decrementKeepAlive():-1; + if (maxKeepAliveRequests > 0) { + socketWrapper.decrementKeepAlive(); + } int soTimeout = endpoint.getSoTimeout(); @@ -198,7 +200,7 @@ public class Http11Processor extends Abs } // Disable keep-alive if we are running low on threads if (threadRatio > getDisableKeepAlivePercentage()) { - keepAliveLeft = 1; + socketWrapper.setKeepAliveLeft(0); } try { @@ -304,8 +306,9 @@ public class Http11Processor extends Abs } } - if (maxKeepAliveRequests > 0 && keepAliveLeft == 0) + if (socketWrapper.getKeepAliveLeft() == 0) { keepAlive = false; + } // Process the request in the adapter if (!error) { @@ -385,8 +388,9 @@ public class Http11Processor extends Abs break; } - keepAliveLeft = - maxKeepAliveRequests>0?socketWrapper.decrementKeepAlive():-1; + if (maxKeepAliveRequests > 0) { + socketWrapper.decrementKeepAlive(); + } } rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org