[MEDIUM] stream_sock: implement tcp-cork for use during shutdowns on Linux

Setting TCP_CORK on a socket before sending the last segment enables
automatic merging of this segment with the FIN from the shutdown()
call. Playing with TCP_CORK is not easy though as we have to track
the status of the TCP_NODELAY flag since both are mutually exclusive.
Doing so saves one more packet per session and offers about 5% more
performance.

There is no reason not to do it, so there is no associated option.
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index ed0812c..e9b3ae3 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -212,9 +212,7 @@
 		goto tcp_close_return;
 	}
 
-	if ((fcntl(fd, F_SETFL, O_NONBLOCK) == -1) ||
-	    (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
-			(char *) &one, sizeof(one)) == -1)) {
+	if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
 		err |= ERR_FATAL | ERR_ALERT;
 		msg = "cannot make socket non-blocking";
 		goto tcp_close_return;
@@ -281,6 +279,7 @@
 	fdtab[fd].cb[DIR_RD].b = fdtab[fd].cb[DIR_WR].b = NULL;
 	fdtab[fd].owner = listener; /* reference the listener instead of a task */
 	fdtab[fd].state = FD_STLISTEN;
+	fdtab[fd].flags = FD_FL_TCP;
 	fdtab[fd].peeraddr = NULL;
 	fdtab[fd].peerlen = 0;
  tcp_return: