summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-12-07 15:12:06 -0800
committerDave Barach <openvpp@barachs.net>2021-12-08 00:13:02 +0000
commit074f3970c6d68d30878e5a2a3a80904182f15e89 (patch)
tree6b5d86bace2cfdafe61034c8c66a0bcb85e4e62a /src
parent13987dab0d79f7253ae5db0d93af923cb0e725b1 (diff)
session: stricter tx checks for ct sessions
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ied4fe0f2b35eeca4e3e82fa21346de7f243aa52a
Diffstat (limited to 'src')
-rw-r--r--src/vnet/session/application_local.c12
1 files changed, 11 insertions, 1 deletions
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)