1
0
mirror of https://passt.top/passt synced 2024-12-22 21:55:22 +00:00

pasta, tcp: Break splice() loop once we've written everything that was read

That's a guarantee that we don't need to retry writing.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2021-09-16 08:29:38 +02:00
parent 34dd4b28b0
commit 492b58d64b

9
tcp.c
View File

@ -2689,10 +2689,15 @@ eintr:
SPLICE_F_MOVE); SPLICE_F_MOVE);
if (written > 0) { if (written > 0) {
if (move_from == conn->from) if (move_from == conn->from) {
conn->from_written += written; conn->from_written += written;
else if (conn->from_read == conn->from_written)
break;
} else {
conn->to_written += written; conn->to_written += written;
if (conn->to_read == conn->to_written)
break;
}
} }
if (written < 0) { if (written < 0) {