MEDIUM: connection: automatically disable polling on error

We absolutely want to disable FD polling after an error is detected,
otherwise the data layer has to do it and it's far from being obvious
at these layers.

The way we did it was a bit tricky in conn_update_*_polling and
conn_*_polling_changes. However it has almost no impact on performance
and code size both for the fast and slow path.

We'll now be able to remove some flag updates in the stream interface.
diff --git a/src/connection.c b/src/connection.c
index 40a24ee..6cb124f 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -139,12 +139,20 @@
  * state as reported in the connection's CO_FL_CURR_* flags, reports of EAGAIN
  * in CO_FL_WAIT_*, and the data layer expectations indicated by CO_FL_DATA_*.
  * The connection flags are updated with the new flags at the end of the
- * operation.
+ * operation. Polling is totally disabled if an error was reported.
  */
 void conn_update_data_polling(struct connection *c)
 {
 	unsigned int f = c->flags;
 
+	if (unlikely(f & CO_FL_ERROR)) {
+		c->flags &= ~(CO_FL_CURR_RD_ENA | CO_FL_CURR_WR_ENA |
+		              CO_FL_SOCK_RD_ENA | CO_FL_SOCK_WR_ENA |
+		              CO_FL_DATA_RD_ENA | CO_FL_DATA_WR_ENA);
+		fd_stop_both(c->t.sock.fd);
+		return;
+	}
+
 	/* 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);
@@ -181,12 +189,20 @@
  * state as reported in the connection's CO_FL_CURR_* flags, reports of EAGAIN
  * in CO_FL_WAIT_*, and the sock layer expectations indicated by CO_FL_SOCK_*.
  * The connection flags are updated with the new flags at the end of the
- * operation.
+ * operation. Polling is totally disabled if an error was reported.
  */
 void conn_update_sock_polling(struct connection *c)
 {
 	unsigned int f = c->flags;
 
+	if (unlikely(f & CO_FL_ERROR)) {
+		c->flags &= ~(CO_FL_CURR_RD_ENA | CO_FL_CURR_WR_ENA |
+		              CO_FL_SOCK_RD_ENA | CO_FL_SOCK_WR_ENA |
+		              CO_FL_DATA_RD_ENA | CO_FL_DATA_WR_ENA);
+		fd_stop_both(c->t.sock.fd);
+		return;
+	}
+
 	/* 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);