]> err.no Git - varnish/commitdiff
Check whether we have accept filters before trying to use them.
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 7 Aug 2006 16:11:29 +0000 (16:11 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 7 Aug 2006 16:11:29 +0000 (16:11 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@728 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/tcp.c
varnish-cache/configure.ac

index 27b6b578cb96a7ff58e2e52c4f82ece00f7518ae..68bd8c0c930b8ba14f3541d37c7c894a8c28124e 100644 (file)
@@ -2,13 +2,14 @@
  * $Id$
  */
 
-#include <string.h>
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+
+#include <assert.h>
+#include <errno.h>
 #include <netdb.h>
+#include <stdio.h>
+#include <string.h>
 
 #include "heritage.h"
 #include "mgt.h"
@@ -46,6 +47,7 @@ TCP_myname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen)
 
 /*--------------------------------------------------------------------*/
 
+#ifdef HAVE_ACCEPT_FILTERS
 static void
 accept_filter(int fd)
 {
@@ -61,6 +63,7 @@ accept_filter(int fd)
                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 @@ open_tcp(const char *port)
        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);
index 447b02b6097f57d60496436e9411334341eb454d..c9eed4d5075a15c0a5f7616f0c09718174512724 100644 (file)
@@ -76,6 +76,11 @@ AC_CHECK_DECL([vasprintf],
        ,
        [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