mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
MEDIUM: connection: only call tcp_connect_probe when nothing was attempted yet
It was observed that after a failed send() on EAGAIN, a second connect() would still be attempted in tcp_connect_probe() because there was no way to know that a send() had failed. By checking the WANT_WR status flag, we know if a previous write attempt failed on EAGAIN, so we don't try to connect again if we know this has already failed. With this simple change, the second connect() has disappeared.
This commit is contained in:
parent
e9dfa79a75
commit
f8deb0cfa8
@ -89,9 +89,10 @@ int conn_fd_handler(int fd)
|
|||||||
if (unlikely(conn->flags & CO_FL_HANDSHAKE))
|
if (unlikely(conn->flags & CO_FL_HANDSHAKE))
|
||||||
goto process_handshake;
|
goto process_handshake;
|
||||||
|
|
||||||
if (unlikely(conn->flags & CO_FL_WAIT_L4_CONN)) {
|
if (unlikely(conn->flags & CO_FL_WAIT_L4_CONN) && !(conn->flags & CO_FL_WAIT_WR)) {
|
||||||
/* still waiting for a connection to establish and no data to
|
/* still waiting for a connection to establish and nothing was
|
||||||
* send in order to probe it ? Then let's retry the connect().
|
* attempted yet to probe the connection. Then let's retry the
|
||||||
|
* connect().
|
||||||
*/
|
*/
|
||||||
if (!tcp_connect_probe(conn))
|
if (!tcp_connect_probe(conn))
|
||||||
goto leave;
|
goto leave;
|
||||||
|
Loading…
Reference in New Issue
Block a user