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 <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2023-11-30 13:02:15 +11:00 committed by Stefano Brivio
parent df96a4cb5d
commit 31bab5f2d9

4
tcp.c
View file

@ -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) 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 itimerspec check_armed = { { 0 }, { 0 } };
struct tcp_tap_conn *conn = CONN(ref.tcp.index);
if (c->no_tcp || !conn) if (c->no_tcp)
return; return;
/* We don't reset timers on ~ACK_FROM_TAP_DUE, ~ACK_TO_TAP_DUE. If the /* We don't reset timers on ~ACK_FROM_TAP_DUE, ~ACK_TO_TAP_DUE. If the