summaryrefslogtreecommitdiffstats
path: root/src/vnet/session
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
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')
-rw-r--r--src/vnet/session/application_interface.c3
-rw-r--r--src/vnet/session/segment_manager.c11
-rw-r--r--src/vnet/session/session.c24
-rw-r--r--src/vnet/session/session.h1
-rw-r--r--src/vnet/session/session_node.c2
5 files changed, 26 insertions, 15 deletions
diff --git a/src/vnet/session/application_interface.c b/src/vnet/session/application_interface.c
index 63666a60e7f..ad4c28b3c77 100644
--- a/src/vnet/session/application_interface.c
+++ b/src/vnet/session/application_interface.c
@@ -500,8 +500,7 @@ vnet_disconnect_session (vnet_disconnect_args_t * a)
/* We're peeking into another's thread pool. Make sure */
ASSERT (s->session_index == index);
- session_send_session_evt_to_thread (a->handle, FIFO_EVENT_DISCONNECT,
- thread_index);
+ stream_session_disconnect (s);
return 0;
}
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index c3a794b7fc4..83b838840d2 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -306,12 +306,7 @@ segment_manager_del_sessions (segment_manager_t * sm)
/* Instead of directly removing the session call disconnect */
if (session->session_state != SESSION_STATE_CLOSED)
- {
- session->session_state = SESSION_STATE_CLOSED;
- session_send_session_evt_to_thread (session_handle (session),
- FIFO_EVENT_DISCONNECT,
- thread_index);
- }
+ stream_session_disconnect (session);
fifo = fifo->next;
}
@@ -611,7 +606,7 @@ segment_manager_show_fn (vlib_main_t * vm, unformat_input_t * input,
segments = svm_fifo_segment_segments_pool ();
vlib_cli_output (vm, "%d svm fifo segments allocated",
pool_elts (segments));
- vlib_cli_output (vm, "%-15s%10s%15s%15s%15s%15s", "Name", "Type",
+ vlib_cli_output (vm, "%-15s%15s%15s%15s%15s%15s", "Name", "Type",
"HeapSize (M)", "ActiveFifos", "FreeFifos", "Address");
/* *INDENT-OFF* */
@@ -619,7 +614,7 @@ segment_manager_show_fn (vlib_main_t * vm, unformat_input_t * input,
svm_fifo_segment_info (seg, &address, &size);
active_fifos = svm_fifo_segment_num_fifos (seg);
free_fifos = svm_fifo_segment_num_free_fifos (seg, ~0 /* size */);
- vlib_cli_output (vm, "%-15v%10U%15llu%15u%15u%15llx",
+ vlib_cli_output (vm, "%-15v%15U%15llu%15u%15u%15llx",
ssvm_name (&seg->ssvm), format_svm_fifo_segment_type,
seg, size >> 20ULL, active_fifos, free_fifos,
address);
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,
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 98e8acb79c1..da9332a2a10 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -448,6 +448,7 @@ int session_open (u32 app_index, session_endpoint_t * tep, u32 opaque);
int stream_session_listen (stream_session_t * s, session_endpoint_t * tep);
int stream_session_stop_listen (stream_session_t * s);
void stream_session_disconnect (stream_session_t * s);
+void stream_session_disconnect_transport (stream_session_t * s);
void stream_session_cleanup (stream_session_t * s);
void session_send_session_evt_to_thread (u64 session_handle,
fifo_event_type_t evt_type,
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index a1608f4a412..796056e7088 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -649,7 +649,7 @@ skip_dequeue:
continue;
}
s0 = session_get_from_handle (e0->session_handle);
- stream_session_disconnect (s0);
+ stream_session_disconnect_transport (s0);
break;
case FIFO_EVENT_BUILTIN_RX:
s0 = session_event_get_session (e0, my_thread_index);