summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_socket.c
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2000-06-15 18:18:43 +0000
committeralfred <alfred@FreeBSD.org>2000-06-15 18:18:43 +0000
commitdcf66cb4e24edd35d222b9fc01940f7b17909c9b (patch)
tree1e28ead6e4cbd084f6bb6b9418cd921c3bcc74db /sys/kern/uipc_socket.c
parenteb646822da4087a78d7c8c9d68871cbeee0aed0b (diff)
downloadFreeBSD-src-dcf66cb4e24edd35d222b9fc01940f7b17909c9b.zip
FreeBSD-src-dcf66cb4e24edd35d222b9fc01940f7b17909c9b.tar.gz
add socketoptions DELAYACCEPT and HTTPACCEPT which will not allow an accept()
until the incoming connection has either data waiting or what looks like a HTTP request header already in the socketbuffer. This ought to reduce the context switch time and overhead for processing requests. The initial idea and code for HTTPACCEPT came from Yahoo engineers and has been cleaned up and a more lightweight DELAYACCEPT for non-http servers has been added Reviewed by: silence on hackers.
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r--sys/kern/uipc_socket.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index b172d46..e83b782 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1050,6 +1050,8 @@ sosetopt(so, sopt)
case SO_REUSEPORT:
case SO_OOBINLINE:
case SO_TIMESTAMP:
+ case SO_DELAYACCEPT:
+ case SO_HTTPACCEPT:
error = sooptcopyin(sopt, &optval, sizeof optval,
sizeof optval);
if (error)
@@ -1215,6 +1217,8 @@ sogetopt(so, sopt)
case SO_BROADCAST:
case SO_OOBINLINE:
case SO_TIMESTAMP:
+ case SO_DELAYACCEPT:
+ case SO_HTTPACCEPT:
optval = so->so_options & sopt->sopt_name;
integer:
error = sooptcopyout(sopt, &optval, sizeof optval);
OpenPOWER on IntegriCloud