diff options
| author | David Gibson <david@gibson.dropbear.id.au> | 2026-03-02 15:31:33 +1100 |
|---|---|---|
| committer | Stefano Brivio <sbrivio@redhat.com> | 2026-03-04 17:51:16 +0100 |
| commit | 7d0fe0830ff37087249ef644d85b8dadd84f1135 (patch) | |
| tree | d9c68be44059cfc1625e3f5883db0cba62d2c8a7 | |
| parent | adbf5c135f19db5b6751393b7f5cbf516031bde8 (diff) | |
| download | passt-7d0fe0830ff37087249ef644d85b8dadd84f1135.tar passt-7d0fe0830ff37087249ef644d85b8dadd84f1135.tar.gz passt-7d0fe0830ff37087249ef644d85b8dadd84f1135.tar.bz2 passt-7d0fe0830ff37087249ef644d85b8dadd84f1135.tar.lz passt-7d0fe0830ff37087249ef644d85b8dadd84f1135.tar.xz passt-7d0fe0830ff37087249ef644d85b8dadd84f1135.tar.zst passt-7d0fe0830ff37087249ef644d85b8dadd84f1135.zip | |
tcp: Use flow_foreach_of_type() in tcp_{keepalive,inactivity}
These functions step through all TCP flows. I forgot there was already
a flow_foreach_of_type() macro which makes this easier. Use it.
Suggested-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
| -rw-r--r-- | tcp.c | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -2907,12 +2907,9 @@ static void tcp_keepalive(struct ctx *c, const struct timespec *now) c->tcp.keepalive_run = now->tv_sec; - flow_foreach(flow) { + flow_foreach_of_type(flow, FLOW_TCP) { struct tcp_tap_conn *conn = &flow->tcp; - if (flow->f.type != FLOW_TCP) - continue; - if (conn->tap_inactive) { flow_dbg(conn, "No tap activity for least %us, send keepalive", KEEPALIVE_INTERVAL); @@ -2938,12 +2935,9 @@ static void tcp_inactivity(struct ctx *c, const struct timespec *now) debug("TCP inactivity scan"); c->tcp.inactivity_run = now->tv_sec; - flow_foreach(flow) { + flow_foreach_of_type(flow, FLOW_TCP) { struct tcp_tap_conn *conn = &flow->tcp; - if (flow->f.type != FLOW_TCP) - continue; - if (conn->inactive) { /* No activity in this interval, reset */ flow_dbg(conn, "Inactive for at least %us, resetting", |
