session: add api to detach session from app
Type: improvement Change-Id: Ib824d0ca9efc7d8967e043db69017655b2dcf6b5 Signed-off-by: Florin Coras <fcoras@cisco.com>
This commit is contained in:
Florin Coras
committed by
Dave Barach
parent
50e7ea7b14
commit
aa78631d75
@ -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.
|
||||
*
|
||||
|
@ -448,6 +448,7 @@ int session_stop_listen (session_t * s);
|
||||
void session_half_close (session_t *s);
|
||||
void session_close (session_t * s);
|
||||
void session_reset (session_t * s);
|
||||
void session_detach_app (session_t *s);
|
||||
void session_transport_half_close (session_t *s);
|
||||
void session_transport_close (session_t * s);
|
||||
void session_transport_reset (session_t * s);
|
||||
|
@ -154,8 +154,7 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index,
|
||||
old_state = s->session_state;
|
||||
if (app->cb_fns.session_accept_callback (s))
|
||||
{
|
||||
session_close (s);
|
||||
s->app_wrk_index = APP_INVALID_INDEX;
|
||||
session_detach_app (s);
|
||||
break;
|
||||
}
|
||||
if (is_builtin)
|
||||
@ -184,8 +183,7 @@ app_worker_flush_events_inline (app_worker_t *app_wrk, u32 thread_index,
|
||||
break;
|
||||
if (rv)
|
||||
{
|
||||
session_close (s);
|
||||
s->app_wrk_index = APP_INVALID_INDEX;
|
||||
session_detach_app (s);
|
||||
break;
|
||||
}
|
||||
if (old_state >= SESSION_STATE_TRANSPORT_CLOSING)
|
||||
|
Reference in New Issue
Block a user