- Experiment with using soTimeout as the keepAliveTimeout if it's not specified ...
authorremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 29 Nov 2006 15:28:00 +0000 (15:28 +0000)
committerremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 29 Nov 2006 15:28:00 +0000 (15:28 +0000)
  remains the same as before - by default).

git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@480598 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/coyote/ajp/Constants.java
java/org/apache/coyote/http11/Constants.java
java/org/apache/coyote/http11/Http11AprProtocol.java
java/org/apache/coyote/http11/Http11Processor.java
java/org/apache/coyote/http11/Http11Protocol.java
java/org/apache/tomcat/util/net/AprEndpoint.java

index f241742..a5d533d 100644 (file)
@@ -17,9 +17,8 @@
 
 package org.apache.coyote.ajp;
 
-import java.lang.IndexOutOfBoundsException;
 import java.util.Hashtable;
-import java.util.Locale;
+
 import org.apache.tomcat.util.buf.ByteChunk;
 
 
@@ -42,7 +41,6 @@ public final class Constants {
     public static final int DEFAULT_CONNECTION_LINGER = -1;
     public static final int DEFAULT_CONNECTION_TIMEOUT = -1;
     public static final int DEFAULT_CONNECTION_UPLOAD_TIMEOUT = 300000;
-    public static final int DEFAULT_KEEPALIVE_TIMEOUT = -1;
     public static final int DEFAULT_SERVER_SOCKET_TIMEOUT = 0;
     public static final boolean DEFAULT_TCP_NO_DELAY = true;
 
index d763a6c..ff07a60 100644 (file)
@@ -39,7 +39,6 @@ public final class Constants {
     public static final int DEFAULT_CONNECTION_LINGER = -1;
     public static final int DEFAULT_CONNECTION_TIMEOUT = 60000;
     public static final int DEFAULT_CONNECTION_UPLOAD_TIMEOUT = 300000;
-    public static final int DEFAULT_KEEPALIVE_TIMEOUT = 60000;
     public static final int DEFAULT_SERVER_SOCKET_TIMEOUT = 0;
     public static final boolean DEFAULT_TCP_NO_DELAY = true;
     
index caf6c37..1f12d15 100644 (file)
@@ -476,6 +476,10 @@ public class Http11AprProtocol implements ProtocolHandler, MBeanRegistration
         ep.setKeepAliveTimeout(timeout);
     }
 
+    public boolean getKeepAlive() {
+        return ((maxKeepAliveRequests != 0) && (maxKeepAliveRequests != 1));
+    }
+
     /**
      * Set the keep-alive policy for this connection.
      */
index fb27ae5..0ce7ccf 100644 (file)
@@ -190,7 +190,7 @@ public class Http11Processor implements ActionHook {
      * The number of seconds Tomcat will wait for a subsequent request
      * before closing the connection.
      */
-    protected int keepAliveTimeout = 15000;
+    protected int keepAliveTimeout = -1;
 
 
     /**
index 881d332..c83e47e 100644 (file)
@@ -71,7 +71,6 @@ public class Http11Protocol
     public Http11Protocol() {
         setSoLinger(Constants.DEFAULT_CONNECTION_LINGER);
         setSoTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
-        setKeepAliveTimeout(Constants.DEFAULT_KEEPALIVE_TIMEOUT);
         //setServerSoTimeout(Constants.DEFAULT_SERVER_SOCKET_TIMEOUT);
         setTcpNoDelay(Constants.DEFAULT_TCP_NO_DELAY);
     }
@@ -292,16 +291,9 @@ public class Http11Protocol
      * before closing the connection. The default is the same as for
      * Apache HTTP Server (15 000 milliseconds).
      */
-    protected int keepAliveTimeout = 15000;
-    public int getKeepAliveTimeout()
-    {
-        return keepAliveTimeout;
-    }
-    
-    public void setKeepAliveTimeout(int timeout)
-    {
-        keepAliveTimeout = timeout;
-    }
+    protected int keepAliveTimeout = -1;
+    public int getKeepAliveTimeout() { return keepAliveTimeout; }
+    public void setKeepAliveTimeout(int timeout) { keepAliveTimeout = timeout; }
 
     // HTTP
     /**
index 9ba4dc8..6d6b000 100644 (file)
@@ -652,6 +652,11 @@ public class AprEndpoint {
             }
         }
         
+        // Initialize keepalive timeout if it has not been set
+        if (keepAliveTimeout == -1) {
+            keepAliveTimeout = soTimeout;
+        }
+        
         // Delay accepting of new connections until data is available
         // Only Linux kernels 2.4 + have that implemented
         // on other platforms this call is noop and will return APR_ENOTIMPL.