r4171 - trunk/varnish-cache/lib/libvarnish
sky at projects.linpro.no
sky at projects.linpro.no
Mon Aug 3 12:25:42 CEST 2009
Author: sky
Date: 2009-08-03 12:25:42 +0200 (Mon, 03 Aug 2009)
New Revision: 4171
Modified:
trunk/varnish-cache/lib/libvarnish/tcp.c
Log:
Implement the linux equivalent of BSD accept filter using TCP_DEFER_ACCEPT
Modified: trunk/varnish-cache/lib/libvarnish/tcp.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/tcp.c 2009-07-31 15:27:34 UTC (rev 4170)
+++ trunk/varnish-cache/lib/libvarnish/tcp.c 2009-08-03 10:25:42 UTC (rev 4171)
@@ -37,6 +37,10 @@
#include <netinet/in.h>
+#ifdef __linux
+#include <netinet/tcp.h>
+#endif
+
#include <errno.h>
#include <sys/ioctl.h>
#ifdef HAVE_SYS_FILIO_H
@@ -114,6 +118,10 @@
printf("Acceptfilter(%d, httpready): %d %s\n",
sock, i, strerror(errno));
return (i);
+#elif defined(__linux)
+ int defer = 1;
+ setsockopt(sock, SOL_TCP,TCP_DEFER_ACCEPT,(char *) &defer, sizeof(int));
+ return (0);
#else
(void)sock;
return (0);
More information about the varnish-commit
mailing list