mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-10 19:21:37 +00:00
OPTIM: splice: detect shutdowns and avoid splice() == 0
Since last commit introducing EPOLLRDHUP, the splicing code is able to detect an incoming shutdown without calling splice() == 0. This avoids one useless syscall.
This commit is contained in:
parent
1c07b0755d
commit
baf2a500a1
@ -148,6 +148,10 @@ int raw_sock_to_pipe(struct connection *conn, struct pipe *pipe, unsigned int co
|
||||
retval += ret;
|
||||
pipe->data += ret;
|
||||
|
||||
/* if a POLL_HUP was present, we've read the last segment */
|
||||
if ((fdtab[conn->t.sock.fd].ev & (FD_POLL_ERR|FD_POLL_HUP)) == FD_POLL_HUP)
|
||||
goto out_read0;
|
||||
|
||||
if (pipe->data >= SPLICE_FULL_HINT || ret >= global.tune.recv_enough) {
|
||||
/* We've read enough of it for this time, let's stop before
|
||||
* being asked to poll.
|
||||
|
Loading…
Reference in New Issue
Block a user