aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2024-11-16 11:42:02 +0100
committerStefano Brivio <sbrivio@redhat.com>2024-11-17 11:22:56 +0100
commit8ae00f8d5d0c482fd450e2c70592b0dbd293d4fa (patch)
tree9edb25b6cd019c38816136471efd9ee13094099d
parent6e1e44293ef991d8c946dd59fbbd65c54901b255 (diff)
downloadpasst-8ae00f8d5d0c482fd450e2c70592b0dbd293d4fa.tar
passt-8ae00f8d5d0c482fd450e2c70592b0dbd293d4fa.tar.gz
passt-8ae00f8d5d0c482fd450e2c70592b0dbd293d4fa.tar.bz2
passt-8ae00f8d5d0c482fd450e2c70592b0dbd293d4fa.tar.lz
passt-8ae00f8d5d0c482fd450e2c70592b0dbd293d4fa.tar.xz
passt-8ae00f8d5d0c482fd450e2c70592b0dbd293d4fa.tar.zst
passt-8ae00f8d5d0c482fd450e2c70592b0dbd293d4fa.zip
tcp: Reset ACK_TO_TAP_DUE flag whenever an ACK isn't needed anymore
We enter the timer handler with the ACK_TO_TAP_DUE flag, call tcp_prepare_flags() with ACK_IF_NEEDED, and realise that we acknowledged everything meanwhile, so we return early, but we also need to reset that flag to avoid unnecessarily scheduling the timer over and over again until more pending data appears. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--tcp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tcp.c b/tcp.c
index 6a98dfa..f357920 100644
--- a/tcp.c
+++ b/tcp.c
@@ -1235,8 +1235,10 @@ int tcp_prepare_flags(const struct ctx *c, struct tcp_tap_conn *conn,
int s = conn->sock;
if (SEQ_GE(conn->seq_ack_to_tap, conn->seq_from_tap) &&
- !flags && conn->wnd_to_tap)
+ !flags && conn->wnd_to_tap) {
+ conn_flag(c, conn, ~ACK_TO_TAP_DUE);
return 0;
+ }
if (getsockopt(s, SOL_TCP, TCP_INFO, &tinfo, &sl)) {
conn_event(c, conn, CLOSED);