httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Finch <...@dotat.at>
Subject Re: Zen regarding accept filters
Date Sun, 30 Jul 2000 02:30:25 GMT
[I've crossposted this to new-httpd@apache.org and freebsd-stable@freebsd.org]

The patch to enable accept filters in Apache is quite simple (see
below) but unfortunately the httpready filter breaks support for
HTTP/0.9. I'm going to try to fix it but until that is done I don't
think the patch should go into Apache without alerting people to this
fact and making them define BREAK_OLD_HTTP at compile time...

Tony.
-- 
en oeccget g mtcaa    f.a.n.finch
v spdlkishrhtewe y    dot@dotat.at
eatp o v eiti i d.    fanf@covalent.net


--- apache-1.3/src/main/http_main.c	2000/07/29 23:56:19	1.507
+++ apache-1.3/src/main/http_main.c	2000/07/30 02:26:25
@@ -3398,6 +3398,34 @@
 	exit(1);
     }
 
+#if defined(SO_ACCEPTFILTER) && defined(BREAK_OLD_HTTP)
+    {
+	/*
+	 * FreeBSD has a feature called "accept filters" which delay the
+	 * return from accept() until a condition has been met, e.g. an
+	 * HTTP request has arrived. This postpones the requirement for a
+	 * child process to handle the new connection which therefore
+	 * increases the number of connections that a given number of
+	 * child processes can handle. It also allows a child process to
+	 * accomplish more immediately after accept() returns (because the
+	 * request is already available to be read) so there is less
+	 * context switching. This feature was added to FreeBSD-4.1-STABLE
+	 * on the 28th of July 2000.
+	 */
+	struct accept_filter_arg af = {
+	    "httpready", ""
+	};
+	if (setsockopt(s, SOL_SOCKET, SO_ACCEPTFILTER, &af, sizeof(af)) < 0) {
+	    ap_log_error(APLOG_MARK, APLOG_CRIT, server_conf,
+			 "make_sock: for %s, setsockopt: (SO_ACCEPTFILTER)",
+			 addr);
+	    close(s);
+	    ap_unblock_alarms();
+	    exit(1);
+	}
+    }
+#endif
+
 #ifdef WORKAROUND_SOLARIS_BUG
     s = ap_slack(s, AP_SLACK_HIGH);
 

Mime
View raw message