Jelajahi Sumber

- freebsd accept filter fix (it works now)

Andrei Pelinescu-Onciul 17 tahun lalu
induk
melakukan
a0b4a4b929
2 mengubah file dengan 15 tambahan dan 15 penghapusan
  1. 13 13
      tcp_main.c
  2. 2 2
      tcp_options.c

+ 13 - 13
tcp_main.c

@@ -1675,19 +1675,6 @@ int tcp_init(struct socket_info* sock_info)
 		}
 	}
 #endif
-#ifdef HAVE_TCP_ACCEPT_FILTER
-	/* freebsd */
-	if (tcp_options.defer_accept){
-		memset(&afa, 0, sizeof(afa));
-		strcpy(afa.af_name, "dataready");
-		if (setsockopt(sock_info->socket, SOL_SOCKET, SO_ACCEPTFILTER,
-					(void*)&afa, sizeof(afa)) ==-1){
-			LOG(L_WARN, "WARNING: tcp_init: setsockopt SO_ACCEPTFILTER %s\n",
-						strerror(errno));
-		/* continue since this is not critical */
-		}
-	}
-#endif /* HAVE_TCP_ACCEPT_FILTER */
 #ifdef HAVE_TCP_LINGER2
 	if (tcp_options.linger2){
 		optval=tcp_options.linger2;
@@ -1716,6 +1703,19 @@ int tcp_init(struct socket_info* sock_info)
 				strerror(errno));
 		goto error;
 	}
+#ifdef HAVE_TCP_ACCEPT_FILTER
+	/* freebsd */
+	if (tcp_options.defer_accept){
+		memset(&afa, 0, sizeof(afa));
+		strcpy(afa.af_name, "dataready");
+		if (setsockopt(sock_info->socket, SOL_SOCKET, SO_ACCEPTFILTER,
+					(void*)&afa, sizeof(afa)) ==-1){
+			LOG(L_WARN, "WARNING: tcp_init: setsockopt SO_ACCEPTFILTER %s\n",
+						strerror(errno));
+		/* continue since this is not critical */
+		}
+	}
+#endif /* HAVE_TCP_ACCEPT_FILTER */
 	
 	return 0;
 error:

+ 2 - 2
tcp_options.c

@@ -62,7 +62,7 @@ void init_tcp_options()
 #define W_OPT_NC(option) \
 	if (tcp_options.option){\
 		WARN("tcp_options: tcp_" #option \
-				"cannot be enabled (recompile needed)\n"); \
+				" cannot be enabled (recompile needed)\n"); \
 		tcp_options.option=0; \
 	}
 
@@ -71,7 +71,7 @@ void init_tcp_options()
 #define W_OPT_NS(option) \
 	if (tcp_options.option){\
 		WARN("tcp_options: tcp_" #option \
-				"cannot be enabled (no OS support)\n"); \
+				" cannot be enabled (no OS support)\n"); \
 		tcp_options.option=0; \
 	}