MAJOR: connection: remove the CO_FL_CURR_*_POL flag

This is the first step of a series of changes aiming at making the
polling totally event-driven. This first change consists in only
remembering at the connection level whether an FD was enabled or not,
regardless of the fact it was being polled or cached. From now on, an
EAGAIN will always be considered as a change so that the pollers are
able to manage a cache and to flush it based on such events. One of
the noticeable effect is that conn_fd_handler() is called once more
per session (6 instead of 5 min) but other update functions are less
called.

Note that the performance loss caused by this change at the moment is
quite significant, around 2.5%, but the change is needed to have SSL
working correctly in all situations, even when data were read from the
socket and stored in the invisible cache, waiting for some room in the
channel's buffer.
diff --git a/src/connection.c b/src/connection.c
index d698e69..3cdc58f 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -175,33 +175,31 @@
 	}
 
 	/* update read status if needed */
-	if (unlikely((f & (CO_FL_CURR_RD_ENA|CO_FL_DATA_RD_ENA)) == CO_FL_CURR_RD_ENA)) {
-		f &= ~(CO_FL_CURR_RD_ENA|CO_FL_CURR_RD_POL);
-		fd_stop_recv(c->t.sock.fd);
-	}
-	else if (unlikely((f & (CO_FL_CURR_RD_ENA|CO_FL_CURR_RD_POL)) != (CO_FL_CURR_RD_ENA|CO_FL_CURR_RD_POL) &&
-	                  (f & (CO_FL_DATA_RD_ENA|CO_FL_WAIT_RD)) == (CO_FL_DATA_RD_ENA|CO_FL_WAIT_RD))) {
-		f |= (CO_FL_CURR_RD_ENA|CO_FL_CURR_RD_POL);
+	if (unlikely((f & (CO_FL_DATA_RD_ENA|CO_FL_WAIT_RD)) == (CO_FL_DATA_RD_ENA|CO_FL_WAIT_RD))) {
 		fd_poll_recv(c->t.sock.fd);
+		f |= CO_FL_CURR_RD_ENA;
 	}
 	else if (unlikely((f & (CO_FL_CURR_RD_ENA|CO_FL_DATA_RD_ENA)) == CO_FL_DATA_RD_ENA)) {
-		f |= CO_FL_CURR_RD_ENA;
 		fd_want_recv(c->t.sock.fd);
+		f |= CO_FL_CURR_RD_ENA;
+	}
+	else if (unlikely((f & (CO_FL_CURR_RD_ENA|CO_FL_DATA_RD_ENA)) == CO_FL_CURR_RD_ENA)) {
+		fd_stop_recv(c->t.sock.fd);
+		f &= ~CO_FL_CURR_RD_ENA;
 	}
 
 	/* update write status if needed */
-	if (unlikely((f & (CO_FL_CURR_WR_ENA|CO_FL_DATA_WR_ENA)) == CO_FL_CURR_WR_ENA)) {
-		f &= ~(CO_FL_CURR_WR_ENA|CO_FL_CURR_WR_POL);
-		fd_stop_send(c->t.sock.fd);
-	}
-	else if (unlikely((f & (CO_FL_CURR_WR_ENA|CO_FL_CURR_WR_POL)) != (CO_FL_CURR_WR_ENA|CO_FL_CURR_WR_POL) &&
-	                  (f & (CO_FL_DATA_WR_ENA|CO_FL_WAIT_WR)) == (CO_FL_DATA_WR_ENA|CO_FL_WAIT_WR))) {
-		f |= (CO_FL_CURR_WR_ENA|CO_FL_CURR_WR_POL);
+	if (unlikely((f & (CO_FL_DATA_WR_ENA|CO_FL_WAIT_WR)) == (CO_FL_DATA_WR_ENA|CO_FL_WAIT_WR))) {
 		fd_poll_send(c->t.sock.fd);
+		f |= CO_FL_CURR_WR_ENA;
 	}
 	else if (unlikely((f & (CO_FL_CURR_WR_ENA|CO_FL_DATA_WR_ENA)) == CO_FL_DATA_WR_ENA)) {
-		f |= CO_FL_CURR_WR_ENA;
 		fd_want_send(c->t.sock.fd);
+		f |= CO_FL_CURR_WR_ENA;
+	}
+	else if (unlikely((f & (CO_FL_CURR_WR_ENA|CO_FL_DATA_WR_ENA)) == CO_FL_CURR_WR_ENA)) {
+		fd_stop_send(c->t.sock.fd);
+		f &= ~CO_FL_CURR_WR_ENA;
 	}
 	c->flags = f;
 }
@@ -225,33 +223,31 @@
 	}
 
 	/* update read status if needed */
-	if (unlikely((f & (CO_FL_CURR_RD_ENA|CO_FL_SOCK_RD_ENA)) == CO_FL_CURR_RD_ENA)) {
-		f &= ~(CO_FL_CURR_RD_ENA|CO_FL_CURR_RD_POL);
-		fd_stop_recv(c->t.sock.fd);
-	}
-	else if (unlikely((f & (CO_FL_CURR_RD_ENA|CO_FL_CURR_RD_POL)) != (CO_FL_CURR_RD_ENA|CO_FL_CURR_RD_POL) &&
-	                  (f & (CO_FL_SOCK_RD_ENA|CO_FL_WAIT_RD)) == (CO_FL_SOCK_RD_ENA|CO_FL_WAIT_RD))) {
-		f |= (CO_FL_CURR_RD_ENA|CO_FL_CURR_RD_POL);
+	if (unlikely((f & (CO_FL_SOCK_RD_ENA|CO_FL_WAIT_RD)) == (CO_FL_SOCK_RD_ENA|CO_FL_WAIT_RD))) {
 		fd_poll_recv(c->t.sock.fd);
+		f |= CO_FL_CURR_RD_ENA;
 	}
 	else if (unlikely((f & (CO_FL_CURR_RD_ENA|CO_FL_SOCK_RD_ENA)) == CO_FL_SOCK_RD_ENA)) {
-		f |= CO_FL_CURR_RD_ENA;
 		fd_want_recv(c->t.sock.fd);
+		f |= CO_FL_CURR_RD_ENA;
+	}
+	else if (unlikely((f & (CO_FL_CURR_RD_ENA|CO_FL_SOCK_RD_ENA)) == CO_FL_CURR_RD_ENA)) {
+		fd_stop_recv(c->t.sock.fd);
+		f &= ~CO_FL_CURR_RD_ENA;
 	}
 
 	/* update write status if needed */
-	if (unlikely((f & (CO_FL_CURR_WR_ENA|CO_FL_SOCK_WR_ENA)) == CO_FL_CURR_WR_ENA)) {
-		f &= ~(CO_FL_CURR_WR_ENA|CO_FL_CURR_WR_POL);
-		fd_stop_send(c->t.sock.fd);
-	}
-	else if (unlikely((f & (CO_FL_CURR_WR_ENA|CO_FL_CURR_WR_POL)) != (CO_FL_CURR_WR_ENA|CO_FL_CURR_WR_POL) &&
-	                  (f & (CO_FL_SOCK_WR_ENA|CO_FL_WAIT_WR)) == (CO_FL_SOCK_WR_ENA|CO_FL_WAIT_WR))) {
-		f |= (CO_FL_CURR_WR_ENA|CO_FL_CURR_WR_POL);
+	if (unlikely((f & (CO_FL_SOCK_WR_ENA|CO_FL_WAIT_WR)) == (CO_FL_SOCK_WR_ENA|CO_FL_WAIT_WR))) {
 		fd_poll_send(c->t.sock.fd);
+		f |= CO_FL_CURR_WR_ENA;
 	}
 	else if (unlikely((f & (CO_FL_CURR_WR_ENA|CO_FL_SOCK_WR_ENA)) == CO_FL_SOCK_WR_ENA)) {
-		f |= CO_FL_CURR_WR_ENA;
 		fd_want_send(c->t.sock.fd);
+		f |= CO_FL_CURR_WR_ENA;
+	}
+	else if (unlikely((f & (CO_FL_CURR_WR_ENA|CO_FL_SOCK_WR_ENA)) == CO_FL_CURR_WR_ENA)) {
+		fd_stop_send(c->t.sock.fd);
+		f &= ~CO_FL_CURR_WR_ENA;
 	}
 	c->flags = f;
 }