r728 - in trunk/varnish-cache: . bin/varnishd

des at projects.linpro.no des at projects.linpro.no
Mon Aug 7 18:11:29 CEST 2006


Author: des
Date: 2006-08-07 18:11:29 +0200 (Mon, 07 Aug 2006)
New Revision: 728

Modified:
   trunk/varnish-cache/bin/varnishd/tcp.c
   trunk/varnish-cache/configure.ac
Log:
Check whether we have accept filters before trying to use them.

Modified: trunk/varnish-cache/bin/varnishd/tcp.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/tcp.c	2006-08-07 16:05:21 UTC (rev 727)
+++ trunk/varnish-cache/bin/varnishd/tcp.c	2006-08-07 16:11:29 UTC (rev 728)
@@ -2,13 +2,14 @@
  * $Id$
  */
 
-#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
 #include <assert.h>
-#include <stdio.h>
 #include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
 #include <netdb.h>
+#include <stdio.h>
+#include <string.h>
 
 #include "heritage.h"
 #include "mgt.h"
@@ -46,6 +47,7 @@
 
 /*--------------------------------------------------------------------*/
 
+#ifdef HAVE_ACCEPT_FILTERS
 static void
 accept_filter(int fd)
 {
@@ -61,6 +63,7 @@
 		printf("Acceptfilter(%d, httpready): %d %s\n",
 		    fd, i, strerror(errno));
 }
+#endif
 
 static void
 create_listen_socket(const char *addr, const char *port, int *sp, int nsp)
@@ -120,11 +123,15 @@
 	for (u = 0; u < HERITAGE_NSOCKS; u++) {
 		if (heritage.sock_local[u] >= 0) {
 			AZ(listen(heritage.sock_local[u], 16));
+#ifdef HAVE_ACCEPT_FILTERS
 			accept_filter(heritage.sock_local[u]);
+#endif
 		}
 		if (heritage.sock_remote[u] >= 0) {
 			AZ(listen(heritage.sock_remote[u], 16));
+#ifdef HAVE_ACCEPT_FILTERS
 			accept_filter(heritage.sock_remote[u]);
+#endif
 		}
 	}
 	return (0);

Modified: trunk/varnish-cache/configure.ac
===================================================================
--- trunk/varnish-cache/configure.ac	2006-08-07 16:05:21 UTC (rev 727)
+++ trunk/varnish-cache/configure.ac	2006-08-07 16:11:29 UTC (rev 728)
@@ -76,6 +76,11 @@
 	,
 	[stdio.h])
 
+AC_CHECK_DECL([SO_ACCEPTFILER],
+	AC_DEFINE(HAVE_ACCEPT_FILTERS,1,[Define to 1 if you have accept filters]),
+	,
+	[sys/types.h, sys/socket.h])
+
 AC_CONFIG_FILES([
     Makefile
     bin/Makefile




More information about the varnish-commit mailing list