Browse code

- freebsd accept filter fix (it works now)

Andrei Pelinescu-Onciul authored on 06/12/2007 12:14:47
Showing 2 changed files
... ...
@@ -1675,19 +1675,6 @@ int tcp_init(struct socket_info* sock_info)
1675 1675
 		}
1676 1676
 	}
1677 1677
 #endif
1678
-#ifdef HAVE_TCP_ACCEPT_FILTER
1679
-	/* freebsd */
1680
-	if (tcp_options.defer_accept){
1681
-		memset(&afa, 0, sizeof(afa));
1682
-		strcpy(afa.af_name, "dataready");
1683
-		if (setsockopt(sock_info->socket, SOL_SOCKET, SO_ACCEPTFILTER,
1684
-					(void*)&afa, sizeof(afa)) ==-1){
1685
-			LOG(L_WARN, "WARNING: tcp_init: setsockopt SO_ACCEPTFILTER %s\n",
1686
-						strerror(errno));
1687
-		/* continue since this is not critical */
1688
-		}
1689
-	}
1690
-#endif /* HAVE_TCP_ACCEPT_FILTER */
1691 1678
 #ifdef HAVE_TCP_LINGER2
1692 1679
 	if (tcp_options.linger2){
1693 1680
 		optval=tcp_options.linger2;
... ...
@@ -1716,6 +1703,19 @@ int tcp_init(struct socket_info* sock_info)
1716 1716
 				strerror(errno));
1717 1717
 		goto error;
1718 1718
 	}
1719
+#ifdef HAVE_TCP_ACCEPT_FILTER
1720
+	/* freebsd */
1721
+	if (tcp_options.defer_accept){
1722
+		memset(&afa, 0, sizeof(afa));
1723
+		strcpy(afa.af_name, "dataready");
1724
+		if (setsockopt(sock_info->socket, SOL_SOCKET, SO_ACCEPTFILTER,
1725
+					(void*)&afa, sizeof(afa)) ==-1){
1726
+			LOG(L_WARN, "WARNING: tcp_init: setsockopt SO_ACCEPTFILTER %s\n",
1727
+						strerror(errno));
1728
+		/* continue since this is not critical */
1729
+		}
1730
+	}
1731
+#endif /* HAVE_TCP_ACCEPT_FILTER */
1719 1732
 	
1720 1733
 	return 0;
1721 1734
 error:
... ...
@@ -62,7 +62,7 @@ void init_tcp_options()
62 62
 #define W_OPT_NC(option) \
63 63
 	if (tcp_options.option){\
64 64
 		WARN("tcp_options: tcp_" #option \
65
-				"cannot be enabled (recompile needed)\n"); \
65
+				" cannot be enabled (recompile needed)\n"); \
66 66
 		tcp_options.option=0; \
67 67
 	}
68 68
 
... ...
@@ -71,7 +71,7 @@ void init_tcp_options()
71 71
 #define W_OPT_NS(option) \
72 72
 	if (tcp_options.option){\
73 73
 		WARN("tcp_options: tcp_" #option \
74
-				"cannot be enabled (no OS support)\n"); \
74
+				" cannot be enabled (no OS support)\n"); \
75 75
 		tcp_options.option=0; \
76 76
 	}
77 77