MEDIUM: tcp: add explicit support for delayed ACK in connect()

Commit 24db47e0 tried to improve support for delayed ACK upon connect
but it was incomplete, because checks with the proxy protocol would
always enable polling for data receive and there was no way of
distinguishing data polling and delayed ack.

So we add a distinct delack flag to the connect() function so that
the caller decides whether or not to use a delayed ack regardless
of pending data (eg: when send-proxy is in use). Doing so covers all
combinations of { (check with data), (sendproxy), (smart-connect) }.
diff --git a/include/proto/proto_tcp.h b/include/proto/proto_tcp.h
index a41e025..d55f4c5 100644
--- a/include/proto/proto_tcp.h
+++ b/include/proto/proto_tcp.h
@@ -30,7 +30,7 @@
 int tcp_bind_socket(int fd, int flags, struct sockaddr_storage *local, struct sockaddr_storage *remote);
 void tcpv4_add_listener(struct listener *listener);
 void tcpv6_add_listener(struct listener *listener);
-int tcp_connect_server(struct connection *conn, int data);
+int tcp_connect_server(struct connection *conn, int data, int delack);
 int tcp_connect_probe(struct connection *conn);
 int tcp_get_src(int fd, struct sockaddr *sa, socklen_t salen, int dir);
 int tcp_get_dst(int fd, struct sockaddr *sa, socklen_t salen, int dir);
diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h
index 7c9595a..c8202bc 100644
--- a/include/proto/stream_interface.h
+++ b/include/proto/stream_interface.h
@@ -111,7 +111,7 @@
 	if (unlikely(!si_ctrl(si) || !si_ctrl(si)->connect))
 		return SN_ERR_INTERNAL;
 
-	ret = si_ctrl(si)->connect(si->conn, !channel_is_empty(si->ob));
+	ret = si_ctrl(si)->connect(si->conn, !channel_is_empty(si->ob), !!si->send_proxy_ofs);
 	if (ret != SN_ERR_NONE)
 		return ret;
 
diff --git a/include/types/protocol.h b/include/types/protocol.h
index a8e020c..0af2ed8 100644
--- a/include/types/protocol.h
+++ b/include/types/protocol.h
@@ -56,7 +56,7 @@
 	int (*unbind_all)(struct protocol *proto);	/* unbind all bound listeners */
 	int (*enable_all)(struct protocol *proto);	/* enable all bound listeners */
 	int (*disable_all)(struct protocol *proto);	/* disable all bound listeners */
-	int (*connect)(struct connection *, int data);  /* connect function if any */
+	int (*connect)(struct connection *, int data, int delack);  /* connect function if any */
 	int (*get_src)(int fd, struct sockaddr *, socklen_t, int dir); /* syscall used to retrieve src addr */
 	int (*get_dst)(int fd, struct sockaddr *, socklen_t, int dir); /* syscall used to retrieve dst addr */