X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fsession%2Fsession.c;h=ec6d7812f0b16a5f477fcc83086ad28b9fbfde07;hb=2f8d8fa50175bf775f66ff15aff2cf08138ccfbd;hp=be98e712e9b028015e77ff37b6cd67f5aed4c290;hpb=a7da67fcc6df3ab319a6873a20a18ee1092d2a9e;p=vpp.git diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c index be98e712e9b..ec6d7812f0b 100644 --- a/src/vnet/session/session.c +++ b/src/vnet/session/session.c @@ -599,7 +599,7 @@ session_stream_connect_notify (transport_connection_t * tc, u8 is_fail) { SESSION_DBG ("failed to notify app"); if (!is_fail) - stream_session_disconnect (new_s); + stream_session_disconnect_transport (new_s); } else { @@ -924,14 +924,30 @@ stream_session_stop_listen (stream_session_t * s) } /** - * Disconnect session and propagate to transport. This should eventually + * Initialize session disconnect. + * + * Request is always sent to session node to ensure that all outstanding + * requests are served before transport is notified. + */ +void +stream_session_disconnect (stream_session_t * s) +{ + if (!s || s->session_state == SESSION_STATE_CLOSED) + return; + s->session_state = SESSION_STATE_CLOSED; + session_send_session_evt_to_thread (session_handle (s), + FIFO_EVENT_DISCONNECT, s->thread_index); +} + +/** + * Notify transport the session can be disconnected. This should eventually * result in a delete notification that allows us to cleanup session state. * Called for both active/passive disconnects. * - * Should be called from the session's thread. + * Must be called from the session's thread. */ void -stream_session_disconnect (stream_session_t * s) +stream_session_disconnect_transport (stream_session_t * s) { s->session_state = SESSION_STATE_CLOSED; tp_vfts[session_get_transport_proto (s)].close (s->connection_index,