aboutgitcodebugslistschat
path: root/tcp.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-09-16 08:29:38 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-09-16 08:50:02 +0200
commit492b58d64b5b6419f6627b609927de2991c58d56 (patch)
tree26d7d7c990e6ac018188ebb997771ca88f9cdab1 /tcp.c
parent34dd4b28b008bb8c6ec7c7b745b00c631563e9a4 (diff)
downloadpasst-492b58d64b5b6419f6627b609927de2991c58d56.tar
passt-492b58d64b5b6419f6627b609927de2991c58d56.tar.gz
passt-492b58d64b5b6419f6627b609927de2991c58d56.tar.bz2
passt-492b58d64b5b6419f6627b609927de2991c58d56.tar.lz
passt-492b58d64b5b6419f6627b609927de2991c58d56.tar.xz
passt-492b58d64b5b6419f6627b609927de2991c58d56.tar.zst
passt-492b58d64b5b6419f6627b609927de2991c58d56.zip
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>
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tcp.c b/tcp.c
index 6e4b99b..eab5c13 100644
--- a/tcp.c
+++ b/tcp.c
@@ -2689,10 +2689,15 @@ eintr:
SPLICE_F_MOVE);
if (written > 0) {
- if (move_from == conn->from)
+ if (move_from == conn->from) {
conn->from_written += written;
- else
+ if (conn->from_read == conn->from_written)
+ break;
+ } else {
conn->to_written += written;
+ if (conn->to_read == conn->to_written)
+ break;
+ }
}
if (written < 0) {