From 074f3970c6d68d30878e5a2a3a80904182f15e89 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Tue, 7 Dec 2021 15:12:06 -0800 Subject: session: stricter tx checks for ct sessions Type: improvement Signed-off-by: Florin Coras Change-Id: Ied4fe0f2b35eeca4e3e82fa21346de7f243aa52a --- src/vnet/session/application_local.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c index 1bf5d9371e1..6d1c9654197 100644 --- a/src/vnet/session/application_local.c +++ b/src/vnet/session/application_local.c @@ -1131,7 +1131,7 @@ static int ct_custom_tx (void *session, transport_send_params_t * sp) { session_t *s = (session_t *) session; - if (session_has_transport (s) || s->session_state < SESSION_STATE_READY) + if (session_has_transport (s)) return 0; /* If event enqueued towards peer, remove from scheduler and remove * session tx flag, i.e., accept new tx events. Unset fifo flag now to @@ -1267,12 +1267,22 @@ static const transport_proto_vft_t cut_thru_proto = { }; /* *INDENT-ON* */ +static inline int +ct_session_can_tx (session_t *s) +{ + return (s->session_state == SESSION_STATE_READY || + s->session_state == SESSION_STATE_CLOSING || + s->session_state == SESSION_STATE_APP_CLOSED); +} + int ct_session_tx (session_t * s) { ct_connection_t *ct, *peer_ct; session_t *peer_s; + if (!ct_session_can_tx (s)) + return 0; ct = (ct_connection_t *) session_get_transport (s); peer_ct = ct_connection_get (ct->peer_index, ct->c_thread_index); if (!peer_ct) -- cgit 1.2.3-korg