tcp: Fix for non-blocking splice() on older kernels
For some reason, on 4.19, splice() doesn't honour SOCK_NONBLOCK from accept4() while reading from a TCP socket. Pass SPLICE_F_NONBLOCK explicitly in all cases. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
9e065b1448
commit
1bddcf3dd7
1 changed files with 2 additions and 2 deletions
4
tcp.c
4
tcp.c
|
@ -3075,7 +3075,7 @@ swap:
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
read = splice(move_from, NULL, pipes[1], NULL, c->tcp.pipe_size,
|
read = splice(move_from, NULL, pipes[1], NULL, c->tcp.pipe_size,
|
||||||
SPLICE_F_MOVE);
|
SPLICE_F_MOVE | SPLICE_F_NONBLOCK);
|
||||||
if (read < 0) {
|
if (read < 0) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
goto retry;
|
goto retry;
|
||||||
|
@ -3099,7 +3099,7 @@ retry:
|
||||||
|
|
||||||
eintr:
|
eintr:
|
||||||
written = splice(pipes[0], NULL, move_to, NULL, to_write,
|
written = splice(pipes[0], NULL, move_to, NULL, to_write,
|
||||||
SPLICE_F_MOVE | more);
|
SPLICE_F_MOVE | more | SPLICE_F_NONBLOCK);
|
||||||
|
|
||||||
/* Most common case: skip updating counters. */
|
/* Most common case: skip updating counters. */
|
||||||
if (read > 0 && read == written) {
|
if (read > 0 && read == written) {
|
||||||
|
|
Loading…
Reference in a new issue