aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2023-02-20 15:14:04 -0800
committerFlorin Coras <fcoras@cisco.com>2023-02-20 18:17:52 -0800
commit7c06b5790d879c216ad27f8e281789b35858db43 (patch)
tree6c373b6eee72f2ae10dd9ebee8c829107692a141 /src/vnet/session/session.c
parenteff5f7aea8c7ca8a63c88624bf962c43b3f8bdd3 (diff)
session: track app session closes
Make sure applications, especially builtin ones, cannot close a session multiple times. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I960a1ae89a48eb359e7e1873a59d47c298c37ef1
Diffstat (limited to 'src/vnet/session/session.c')
-rw-r--r--src/vnet/session/session.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index eaba80f24e2..b0dbb9ddfe8 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -1526,9 +1526,15 @@ session_half_close (session_t *s)
void
session_close (session_t * s)
{
- if (!s)
+ if (!s || (s->flags & SESSION_F_APP_CLOSED))
return;
+ /* Transports can close and delete their state independent of app closes
+ * and transport initiated state transitions can hide app closes. Instead
+ * of extending the state machine to support separate tracking of app and
+ * transport initiated closes, use a flag. */
+ s->flags |= SESSION_F_APP_CLOSED;
+
if (s->session_state >= SESSION_STATE_CLOSING)
{
/* Session will only be removed once both app and transport