r4298 - branches/2.0/varnish-cache/lib/libvarnish

tfheen at projects.linpro.no tfheen at projects.linpro.no
Thu Oct 8 15:07:00 CEST 2009


Author: tfheen
Date: 2009-10-08 15:07:00 +0200 (Thu, 08 Oct 2009)
New Revision: 4298

Modified:
   branches/2.0/varnish-cache/lib/libvarnish/tcp.c
Log:
Merge r4171: Implement the linux equivalent of BSD accept filter using TCP_DEFER_ACCEPT



Modified: branches/2.0/varnish-cache/lib/libvarnish/tcp.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvarnish/tcp.c	2009-10-08 12:57:04 UTC (rev 4297)
+++ branches/2.0/varnish-cache/lib/libvarnish/tcp.c	2009-10-08 13:07:00 UTC (rev 4298)
@@ -36,6 +36,10 @@
 
 #include <netinet/in.h>
 
+#ifdef __linux
+#include <netinet/tcp.h>
+#endif
+
 #include <errno.h>
 #include <sys/ioctl.h>
 #ifdef HAVE_SYS_FILIO_H
@@ -113,6 +117,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