MEDIUM: connection: make use of the new polling functions

Now the connection handler, the handshake callbacks and the I/O callbacks
make use of the connection-layer polling functions to enable or disable
polling on a file descriptor.

Some changes still need to be done to avoid using the FD_WAIT_* constants.
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 7de238a..2f56797 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -475,7 +475,9 @@
 
 	fdtab[fd].iocb = conn_fd_handler;
 	fd_insert(fd);
-	fd_want_send(fd);  /* for connect status */
+	conn_sock_want_send(&si->conn);  /* for connect status */
+	if (!(si->ob->flags & BF_OUT_EMPTY))
+		conn_data_want_send(&si->conn);  /* prepare to send data if any */
 
 	si->state = SI_ST_CON;
 	si->flags |= SI_FL_CAP_SPLTCP; /* TCP supports splicing */
@@ -548,8 +550,11 @@
 	 *  - connected (EISCONN, 0)
 	 */
 	if ((connect(fd, conn->peeraddr, conn->peerlen) < 0)) {
-		if (errno == EALREADY || errno == EINPROGRESS)
+		if (errno == EALREADY || errno == EINPROGRESS) {
+			conn_sock_stop_recv(conn);
+			conn_sock_poll_send(conn);
 			return 0;
+		}
 
 		if (errno && errno != EISCONN)
 			goto out_error;
@@ -570,7 +575,7 @@
 	 */
 
 	conn->flags |= CO_FL_ERROR;
-	fd_stop_both(fd);
+	conn_sock_stop_both(conn);
 	return 1;
 }