From a68fabcd0be95eda6c14d84c6b6b173d45ca5ba2 Mon Sep 17 00:00:00 2001 From: markt Date: Thu, 5 May 2011 15:11:18 +0000 Subject: [PATCH] Simplify the keep-alive tracking and fix a couple of issues with the keep-alive disable code git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1099838 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/coyote/http11/Http11Processor.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/java/org/apache/coyote/http11/Http11Processor.java b/java/org/apache/coyote/http11/Http11Processor.java index bff093cc0..337466a1b 100644 --- a/java/org/apache/coyote/http11/Http11Processor.java +++ b/java/org/apache/coyote/http11/Http11Processor.java @@ -183,7 +183,9 @@ public class Http11Processor extends AbstractHttp11Processor { 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 AbstractHttp11Processor { } // 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 AbstractHttp11Processor { } } - 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 AbstractHttp11Processor { break; } - keepAliveLeft = - maxKeepAliveRequests>0?socketWrapper.decrementKeepAlive():-1; + if (maxKeepAliveRequests > 0) { + socketWrapper.decrementKeepAlive(); + } } rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); -- 2.11.0