Add support for TCP_DEFER_ACCEPT
authorVolker Lendecke <vl@samba.org>
Thu, 15 Dec 2011 15:12:37 +0000 (16:12 +0100)
committerVolker Lendecke <vl@samba.org>
Fri, 16 Dec 2011 06:34:48 +0000 (07:34 +0100)
"man tcp" on Linux says:

TCP_DEFER_ACCEPT

Allows a listener to be awakened only when data arrives on the  socket.  Takes
an integer value (seconds), this can bound the maximum number of attempts TCP
will make to complete the connection. This option should not be used in code
intended to be portable.

This might reduce the 139/445 forks a bit on high-load servers

lib/util/util_net.c

index 1f6ecdd87ba6eed8b8c3a35cc2788f603a686256..637c52b988403a3261984aabed2460b7ddc4d99d 100644 (file)
@@ -811,6 +811,9 @@ static const smb_socket_option socket_options[] = {
 #endif
 #ifdef TCP_KEEPALIVE_ABORT_THRESHOLD
   {"TCP_KEEPALIVE_ABORT_THRESHOLD", IPPROTO_TCP, TCP_KEEPALIVE_ABORT_THRESHOLD, 0, OPT_INT},
+#endif
+#ifdef TCP_DEFER_ACCEPT
+  {"TCP_DEFER_ACCEPT", IPPROTO_TCP, TCP_DEFER_ACCEPT, 0, OPT_INT},
 #endif
   {NULL,0,0,0,0}};