aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-09-14 07:15:08 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-09-14 16:57:50 +0200
commit9af8e0a1a7e7774e39f4739b2754018b8ae69219 (patch)
tree231549eafe1598582cdf44be8229b7fb52260e9a
parenta616357c864539d366f40ca37b687757c109144f (diff)
downloadpasst-9af8e0a1a7e7774e39f4739b2754018b8ae69219.tar
passt-9af8e0a1a7e7774e39f4739b2754018b8ae69219.tar.gz
passt-9af8e0a1a7e7774e39f4739b2754018b8ae69219.tar.bz2
passt-9af8e0a1a7e7774e39f4739b2754018b8ae69219.tar.lz
passt-9af8e0a1a7e7774e39f4739b2754018b8ae69219.tar.xz
passt-9af8e0a1a7e7774e39f4739b2754018b8ae69219.tar.zst
passt-9af8e0a1a7e7774e39f4739b2754018b8ae69219.zip
tcp: Request retransmission with updated sequence also on partial write to socket
If we couldn't write the whole batch of received packets to the socket, and we have missing segments, we still need to request their retransmission right away, otherwise it will take ages for the guest to figure out we're missing them. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--tcp.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/tcp.c b/tcp.c
index e58658e..4d2d485 100644
--- a/tcp.c
+++ b/tcp.c
@@ -2088,13 +2088,8 @@ static void tcp_data_from_tap(struct ctx *c, struct tcp_tap_conn *conn,
return;
}
- if (keep != -1) {
- tcp_send_to_tap(c, conn, ACK, NULL, 0);
- tcp_send_to_tap(c, conn, ACK, NULL, 0);
- }
-
if (!iov_i)
- goto fin_check;
+ goto out;
mh.msg_iovlen = iov_i;
eintr:
@@ -2114,14 +2109,16 @@ eintr:
if (len < (seq_from_tap - conn->seq_from_tap)) {
conn->seq_from_tap += len;
tcp_send_to_tap(c, conn, ZERO_WINDOW, NULL, 0);
- return;
+ } else {
+ conn->seq_from_tap += len;
}
- conn->seq_from_tap += len;
-
-fin_check:
- if (keep != -1)
+out:
+ if (keep != -1) {
+ tcp_send_to_tap(c, conn, ACK, NULL, 0);
+ tcp_send_to_tap(c, conn, ACK, NULL, 0);
return;
+ }
if (ack) {
if (conn->state == ESTABLISHED_SOCK_FIN_SENT &&