summaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/session.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index e1a93a6e250..67e7ee39001 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -273,7 +273,7 @@ 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)
+ if (PREDICT_FALSE (!app_wrk))
{
if (ntf == SESSION_CLEANUP_TRANSPORT)
return;
@@ -1600,11 +1600,28 @@ void
session_detach_app (session_t *s)
{
if (s->session_state < SESSION_STATE_TRANSPORT_CLOSING)
- session_close (s);
- else if (s->session_state < SESSION_STATE_TRANSPORT_CLOSED)
- session_set_state (s, SESSION_STATE_APP_CLOSED);
- else if (s->session_state < SESSION_STATE_CLOSED)
- session_set_state (s, SESSION_STATE_CLOSED);
+ {
+ session_close (s);
+ }
+ else if (s->session_state < SESSION_STATE_TRANSPORT_DELETED)
+ {
+ transport_connection_t *tc;
+
+ /* Transport is closing but it's not yet deleted. Confirm close and
+ * subsequently detach transport from session and enqueue a session
+ * cleanup notification. Transport closed and cleanup notifications are
+ * going to be dropped by session layer apis */
+ transport_close (session_get_transport_proto (s), s->connection_index,
+ s->thread_index);
+ tc = session_get_transport (s);
+ tc->s_index = SESSION_INVALID_INDEX;
+ session_set_state (s, SESSION_STATE_TRANSPORT_DELETED);
+ session_cleanup_notify (s, SESSION_CLEANUP_SESSION);
+ }
+ else
+ {
+ session_cleanup_notify (s, SESSION_CLEANUP_SESSION);
+ }
s->flags |= SESSION_F_APP_CLOSED;
s->app_wrk_index = APP_INVALID_INDEX;