mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
MINOR: raw-sock: don't try to send if an error was already reported
There's no point trying to send() on a socket on which an error was already reported. This wastes syscalls. Till now it was possible to occasionally see an attempt to sendto() after epoll_wait() had reported EPOLLERR.
This commit is contained in:
parent
2c30de3b90
commit
c6fc77404e
@ -360,6 +360,13 @@ static size_t raw_sock_from_buf(struct connection *conn, void *xprt_ctx, const s
|
|||||||
if (!fd_send_ready(conn->handle.fd))
|
if (!fd_send_ready(conn->handle.fd))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (unlikely(fdtab[conn->handle.fd].state & FD_POLL_ERR)) {
|
||||||
|
/* an error was reported on the FD, we can't send anymore */
|
||||||
|
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_WR_SH | CO_FL_SOCK_RD_SH;
|
||||||
|
errno = EPIPE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (conn->flags & CO_FL_SOCK_WR_SH) {
|
if (conn->flags & CO_FL_SOCK_WR_SH) {
|
||||||
/* it's already closed */
|
/* it's already closed */
|
||||||
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH;
|
conn->flags |= CO_FL_ERROR | CO_FL_SOCK_RD_SH;
|
||||||
|
Loading…
Reference in New Issue
Block a user