From 31bab5f2d936c1b3d09ecb8bd9e4aeb0ab9f6bf6 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Thu, 30 Nov 2023 13:02:15 +1100 Subject: tcp: Remove unneccessary bounds check in tcp_timer_handler() In tcp_timer_handler() we use conn_at_idx() to interpret the flow index from the epoll reference. However, this will never be NULL - we always put a valid index into the epoll_ref. Simplify slightly based on this. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tcp.c') diff --git a/tcp.c b/tcp.c index a83704e..69ecc49 100644 --- a/tcp.c +++ b/tcp.c @@ -2758,10 +2758,10 @@ void tcp_listen_handler(struct ctx *c, union epoll_ref ref, */ void tcp_timer_handler(struct ctx *c, union epoll_ref ref) { - struct tcp_tap_conn *conn = conn_at_idx(ref.tcp.index); struct itimerspec check_armed = { { 0 }, { 0 } }; + struct tcp_tap_conn *conn = CONN(ref.tcp.index); - if (c->no_tcp || !conn) + if (c->no_tcp) return; /* We don't reset timers on ~ACK_FROM_TAP_DUE, ~ACK_TO_TAP_DUE. If the -- cgit v1.2.3