summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-01-26 06:36:04 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2018-01-27 10:49:55 +0000
commit2f8d8fa50175bf775f66ff15aff2cf08138ccfbd (patch)
tree956479a32c75e5936431c46d43f3cbc728b6e5de /src/vnet/session/session.c
parenta7da67fcc6df3ab319a6873a20a18ee1092d2a9e (diff)
session: disconnect and echo client improvements
Change-Id: If421bad17b6cfe8e321257c93bb38931e37d7b64 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/session.c')
-rw-r--r--src/vnet/session/session.c24
1 files changed, 20 insertions, 4 deletions
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,