MEDIUM: connection: add check for readiness in I/O handlers
The recv/send callbacks must check for readiness themselves instead of
having their callers do it. This will strengthen the test and will also
ensure we never refrain from calling a handshake handler because a
direction is being polled while the other one is ready.
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index cb10661..79c7baf 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -632,6 +632,9 @@
if (!(conn->flags & CO_FL_WAIT_L4_CONN))
return 1; /* strange we were called while ready */
+ if (!fd_send_ready(fd))
+ return 0;
+
/* we might be the first witness of FD_POLL_ERR. Note that FD_POLL_HUP
* without FD_POLL_IN also indicates a hangup without input data meaning
* there was no connection.