Author: markt
Date: Tue Aug 16 12:19:49 2011
New Revision: 1158227
URL: http://svn.apache.org/viewvc?rev=1158227&view=rev
Log:
Align keep-alive count tracking for HTTP
Modified:
tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java
Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=1158227&r1=1158226&r2=1158227&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java Tue Aug
16 12:19:49 2011
@@ -184,8 +184,6 @@ public class Http11AprProcessor extends
long soTimeout = endpoint.getSoTimeout();
- int keepAliveLeft = maxKeepAliveRequests;
-
boolean keptAlive = false;
boolean openSocket = false;
boolean sendfileInProgress = false;
@@ -253,8 +251,12 @@ public class Http11AprProcessor extends
}
}
- if (maxKeepAliveRequests > 0 && --keepAliveLeft == 0)
+ if (maxKeepAliveRequests == 1) {
+ keepAlive = false;
+ } else if (maxKeepAliveRequests > 0 &&
+ socketWrapper.decrementKeepAlive() <= 0) {
keepAlive = false;
+ }
// Process the request in the adapter
if (!error) {
Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1158227&r1=1158226&r2=1158227&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Tue Aug
16 12:19:49 2011
@@ -299,10 +299,12 @@ public class Http11NioProcessor extends
}
}
- if (maxKeepAliveRequests == 1 )
+ if (maxKeepAliveRequests == 1) {
keepAlive = false;
- if (maxKeepAliveRequests > 0 && socketWrapper.decrementKeepAlive()
<= 0)
+ } else if (maxKeepAliveRequests > 0 &&
+ socketWrapper.decrementKeepAlive() <= 0) {
keepAlive = false;
+ }
// Process the request in the adapter
if (!error) {
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=1158227&r1=1158226&r2=1158227&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java Tue Aug 16
12:19:49 2011
@@ -148,10 +148,6 @@ public class Http11Processor extends Abs
int soTimeout = endpoint.getSoTimeout();
- if (maxKeepAliveRequests > 0) {
- socketWrapper.decrementKeepAlive();
- }
-
int threadRatio = -1;
// These may return zero or negative values
// Only calculate a thread ratio when both are >0 to ensure we get a
@@ -269,7 +265,10 @@ public class Http11Processor extends Abs
}
}
- if (socketWrapper.getKeepAliveLeft() == 0) {
+ if (maxKeepAliveRequests == 1) {
+ keepAlive = false;
+ } else if (maxKeepAliveRequests > 0 &&
+ socketWrapper.decrementKeepAlive() <= 0) {
keepAlive = false;
}
@@ -351,10 +350,6 @@ public class Http11Processor extends Abs
if (isAsync() || error || inputBuffer.lastValid == 0) {
break;
}
-
- if (maxKeepAliveRequests > 0) {
- socketWrapper.decrementKeepAlive();
- }
}
rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]