From abe6d5cb93f900b3fd6c04efc0401f1de428dd48 Mon Sep 17 00:00:00 2001 From: markt Date: Mon, 27 Oct 2008 22:04:51 +0000 Subject: [PATCH] Expose deferAccept for APR HTTP connector. I did consider adding this to the AJP connector as well but since this is to work around a buggy client and we control the client in the AJP case, I couldn't see a need for it. Patch provided by Michael Leinartas. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@708344 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/coyote/http11/Http11AprProtocol.java | 5 ++++- java/org/apache/tomcat/util/net/AprEndpoint.java | 14 +++++++++----- webapps/docs/config/ajp.xml | 7 +++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/java/org/apache/coyote/http11/Http11AprProtocol.java b/java/org/apache/coyote/http11/Http11AprProtocol.java index c19c38c4f..c7c6c7d9c 100644 --- a/java/org/apache/coyote/http11/Http11AprProtocol.java +++ b/java/org/apache/coyote/http11/Http11AprProtocol.java @@ -250,7 +250,10 @@ public class Http11AprProtocol implements ProtocolHandler, MBeanRegistration { public void setSendfileThreadCount(int sendfileThreadCount) { endpoint.setSendfileThreadCount(sendfileThreadCount); } public int getSendfileThreadCount() { return endpoint.getSendfileThreadCount(); } - + + public boolean getDeferAccept() { return endpoint.getDeferAccept(); } + public void setDeferAccept(boolean deferAccept) { endpoint.setDeferAccept(deferAccept); } + protected int socketBuffer = 9000; public int getSocketBuffer() { return socketBuffer; } public void setSocketBuffer(int socketBuffer) { this.socketBuffer = socketBuffer; } diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java index 9d53b46ee..57a929ad3 100644 --- a/java/org/apache/tomcat/util/net/AprEndpoint.java +++ b/java/org/apache/tomcat/util/net/AprEndpoint.java @@ -156,15 +156,17 @@ public class AprEndpoint { protected long sslContext = 0; + // ------------------------------------------------------------- Properties + + /** * Defer accept. */ protected boolean deferAccept = true; + public void setDeferAccept(boolean deferAccept) { this.deferAccept = deferAccept; } + public boolean getDeferAccept() { return deferAccept; } - // ------------------------------------------------------------- Properties - - /** * External Executor based thread pool. */ @@ -659,8 +661,10 @@ public class AprEndpoint { // 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. - if (Socket.optSet(serverSock, Socket.APR_TCP_DEFER_ACCEPT, 1) == Status.APR_ENOTIMPL) { - deferAccept = false; + if (deferAccept) { + if (Socket.optSet(serverSock, Socket.APR_TCP_DEFER_ACCEPT, 1) == Status.APR_ENOTIMPL) { + deferAccept = false; + } } // Initialize SSL if needed diff --git a/webapps/docs/config/ajp.xml b/webapps/docs/config/ajp.xml index 4bd755a66..f78e0156a 100644 --- a/webapps/docs/config/ajp.xml +++ b/webapps/docs/config/ajp.xml @@ -236,6 +236,13 @@ presented. The default value is infinite (i.e. no timeout).

+ +

Sets the TCP_DEFER_ACCEPT flag on the listening socket for + this connector. The default value is true where + TCP_DEFER_ACCEPT is supported by the operating system, + otherwise it is false.

+
+

A reference to the name in an Executor element. If this attribute is enabled, and the named executor exists, the connector will -- 2.11.0