From: markt Date: Tue, 16 Aug 2011 11:12:13 +0000 (+0000) Subject: Make handling of keep-alive timeout consistent X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=55015ab8c1d19076156916480f64da2592e41f49;p=tomcat7.0 Make handling of keep-alive timeout consistent No need for local variable, processor has the keep-alive timeout git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1158199 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/coyote/http11/Http11AprProcessor.java b/java/org/apache/coyote/http11/Http11AprProcessor.java index 01f884a8f..4a94330f4 100644 --- a/java/org/apache/coyote/http11/Http11AprProcessor.java +++ b/java/org/apache/coyote/http11/Http11AprProcessor.java @@ -182,8 +182,9 @@ public class Http11AprProcessor extends AbstractHttp11Processor { keepAlive = true; comet = false; - int keepAliveLeft = maxKeepAliveRequests; long soTimeout = endpoint.getSoTimeout(); + + int keepAliveLeft = maxKeepAliveRequests; boolean keptAlive = false; boolean openSocket = false; diff --git a/java/org/apache/coyote/http11/Http11AprProtocol.java b/java/org/apache/coyote/http11/Http11AprProtocol.java index b0ecbc860..47a6ac4d0 100644 --- a/java/org/apache/coyote/http11/Http11AprProtocol.java +++ b/java/org/apache/coyote/http11/Http11AprProtocol.java @@ -247,6 +247,7 @@ public class Http11AprProtocol extends AbstractHttp11Protocol { proto.getMaxTrailerSize()); processor.setAdapter(proto.adapter); processor.setMaxKeepAliveRequests(proto.getMaxKeepAliveRequests()); + processor.setKeepAliveTimeout(proto.getKeepAliveTimeout()); processor.setConnectionUploadTimeout( proto.getConnectionUploadTimeout()); processor.setDisableUploadTimeout(proto.getDisableUploadTimeout()); diff --git a/java/org/apache/coyote/http11/Http11NioProcessor.java b/java/org/apache/coyote/http11/Http11NioProcessor.java index 3ac942188..78f91e60e 100644 --- a/java/org/apache/coyote/http11/Http11NioProcessor.java +++ b/java/org/apache/coyote/http11/Http11NioProcessor.java @@ -123,7 +123,6 @@ public class Http11NioProcessor extends AbstractHttp11Processor { throws IOException { long soTimeout = endpoint.getSoTimeout(); - int keepAliveTimeout = endpoint.getKeepAliveTimeout(); RequestInfo rp = request.getRequestProcessor(); final NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socket.getSocket().getAttachment(false); @@ -176,7 +175,6 @@ public class Http11NioProcessor extends AbstractHttp11Processor { if (!error && attach != null && asyncStateMachine.isAsyncDispatching()) { long soTimeout = endpoint.getSoTimeout(); - int keepAliveTimeout = endpoint.getKeepAliveTimeout(); //reset the timeout if (keepAlive && keepAliveTimeout>0) { @@ -214,7 +212,6 @@ public class Http11NioProcessor extends AbstractHttp11Processor { comet = false; long soTimeout = endpoint.getSoTimeout(); - int keepAliveTimeout = endpoint.getKeepAliveTimeout(); boolean keptAlive = false; boolean openSocket = false; diff --git a/java/org/apache/coyote/http11/Http11NioProtocol.java b/java/org/apache/coyote/http11/Http11NioProtocol.java index ece2c0aa8..1ff59ff4d 100644 --- a/java/org/apache/coyote/http11/Http11NioProtocol.java +++ b/java/org/apache/coyote/http11/Http11NioProtocol.java @@ -277,6 +277,7 @@ public class Http11NioProtocol extends AbstractHttp11JsseProtocol { proto.getMaxTrailerSize()); processor.setAdapter(proto.adapter); processor.setMaxKeepAliveRequests(proto.getMaxKeepAliveRequests()); + processor.setKeepAliveTimeout(proto.getKeepAliveTimeout()); processor.setConnectionUploadTimeout( proto.getConnectionUploadTimeout()); processor.setDisableUploadTimeout(proto.getDisableUploadTimeout()); diff --git a/java/org/apache/coyote/http11/Http11Processor.java b/java/org/apache/coyote/http11/Http11Processor.java index 57a661659..653778866 100644 --- a/java/org/apache/coyote/http11/Http11Processor.java +++ b/java/org/apache/coyote/http11/Http11Processor.java @@ -146,12 +146,12 @@ public class Http11Processor extends AbstractHttp11Processor { keepAlive = true; comet = false; + int soTimeout = endpoint.getSoTimeout(); + if (maxKeepAliveRequests > 0) { socketWrapper.decrementKeepAlive(); } - int soTimeout = endpoint.getSoTimeout(); - int threadRatio = -1; // These may return zero or negative values // Only calculate a thread ratio when both are >0 to ensure we get a