summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2024-04-09 13:27:53 -0700
committerDave Barach <vpp@barachs.net>2024-04-10 19:35:48 +0000
commitaa78631d755bf9f55532935599b9964f943a27f3 (patch)
tree00217504b9886568b1b6db09a47272943829e57c /src/vnet/session/session.c
parent50e7ea7b14863a155a359fb192df9a23883a3391 (diff)
session: add api to detach session from app
Type: improvement Change-Id: Ib824d0ca9efc7d8967e043db69017655b2dcf6b5 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/session.c')
-rw-r--r--src/vnet/session/session.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 633aebd5483..e1a93a6e250 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -1596,6 +1596,20 @@ session_reset (session_t * s)
session_program_transport_ctrl_evt (s, SESSION_CTRL_EVT_RESET);
}
+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);
+
+ s->flags |= SESSION_F_APP_CLOSED;
+ s->app_wrk_index = APP_INVALID_INDEX;
+}
+
/**
* Notify transport the session can be half-disconnected.
*