aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-07-08 11:47:18 -0700
committerDave Wallace <dwallacelf@gmail.com>2019-07-09 17:34:13 +0000
commit70f26d5425f72ebf207ad4ca6e83c1b7ff959c18 (patch)
tree5fc34587c8791794cd1f8ec52ece6b224975490d /src/vnet/session/session.c
parentace51525552375b4716c01a6f9ba5261fd64f940 (diff)
session: notify app of session and transport cleanup
Type:feature Change-Id: Ic9515c0b11ca6f75503f47ec6b2c58d240afb144 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/session.c')
-rw-r--r--src/vnet/session/session.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index d378d6d2426..5b4e840f053 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -179,9 +179,21 @@ session_free (session_t * s)
pool_put (session_main.wrk[s->thread_index].sessions, s);
}
+static void
+session_cleanup_notify (session_t * s, session_cleanup_ntf_t ntf)
+{
+ app_worker_t *app_wrk;
+
+ app_wrk = app_worker_get_if_valid (s->app_wrk_index);
+ if (!app_wrk)
+ return;
+ app_worker_cleanup_notify (app_wrk, s, ntf);
+}
+
void
session_free_w_fifos (session_t * s)
{
+ session_cleanup_notify (s, SESSION_CLEANUP_SESSION);
segment_manager_dealloc_fifos (s->rx_fifo, s->tx_fifo);
session_free (s);
}
@@ -774,9 +786,6 @@ session_transport_delete_notify (transport_connection_t * tc)
if (!(s = session_get_if_valid (tc->s_index, tc->thread_index)))
return;
- /* Make sure we don't try to send anything more */
- svm_fifo_dequeue_drop_all (s->tx_fifo);
-
switch (s->session_state)
{
case SESSION_STATE_CREATED:
@@ -794,6 +803,8 @@ session_transport_delete_notify (transport_connection_t * tc)
* are assumed to have been removed from the lookup table */
session_lookup_del_session (s);
s->session_state = SESSION_STATE_TRANSPORT_CLOSED;
+ session_cleanup_notify (s, SESSION_CLEANUP_TRANSPORT);
+ svm_fifo_dequeue_drop_all (s->tx_fifo);
break;
case SESSION_STATE_CLOSING:
case SESSION_STATE_CLOSED_WAITING:
@@ -805,14 +816,18 @@ session_transport_delete_notify (transport_connection_t * tc)
session_lookup_del_session (s);
s->session_state = SESSION_STATE_TRANSPORT_CLOSED;
session_program_transport_close (s);
+ session_cleanup_notify (s, SESSION_CLEANUP_TRANSPORT);
+ svm_fifo_dequeue_drop_all (s->tx_fifo);
break;
case SESSION_STATE_TRANSPORT_CLOSED:
break;
case SESSION_STATE_CLOSED:
+ session_cleanup_notify (s, SESSION_CLEANUP_TRANSPORT);
session_delete (s);
break;
default:
clib_warning ("session state %u", s->session_state);
+ session_cleanup_notify (s, SESSION_CLEANUP_TRANSPORT);
session_delete (s);
break;
}