diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vnet/session-apps/echo_client.c | 18 | ||||
-rw-r--r-- | src/vnet/session/application_interface.c | 3 | ||||
-rw-r--r-- | src/vnet/session/segment_manager.c | 11 | ||||
-rw-r--r-- | src/vnet/session/session.c | 24 | ||||
-rw-r--r-- | src/vnet/session/session.h | 1 | ||||
-rw-r--r-- | src/vnet/session/session_node.c | 2 | ||||
-rwxr-xr-x | src/vnet/tcp/tcp_debug.h | 2 |
7 files changed, 38 insertions, 23 deletions
diff --git a/src/vnet/session-apps/echo_client.c b/src/vnet/session-apps/echo_client.c index b8a4fb31f26..c38b5339453 100644 --- a/src/vnet/session-apps/echo_client.c +++ b/src/vnet/session-apps/echo_client.c @@ -257,7 +257,10 @@ echo_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, __sync_fetch_and_add (&ecm->ready_connections, -1); } else - clib_warning ("session AWOL?"); + { + clib_warning ("session AWOL?"); + vec_delete (connections_this_batch, 1, i); + } /* Kick the debug CLI process */ if (ecm->ready_connections == 0) @@ -407,7 +410,6 @@ echo_clients_session_disconnect_callback (stream_session_t * s) static int echo_clients_rx_callback (stream_session_t * s) { - clib_warning ("BUG"); return 0; } @@ -424,7 +426,7 @@ static session_cb_vft_t echo_clients = { static clib_error_t * echo_clients_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret) { - u32 prealloc_fifos, segment_size = 2 << 20; + u32 prealloc_fifos, segment_size = 256 << 20; echo_client_main_t *ecm = &echo_client_main; vnet_app_attach_args_t _a, *a = &_a; u64 options[16]; @@ -543,15 +545,16 @@ echo_clients_command_fn (vlib_main_t * vm, { echo_client_main_t *ecm = &echo_client_main; vlib_thread_main_t *thread_main = vlib_get_thread_main (); - uword *event_data = 0, event_type; - u8 *default_uri = (u8 *) "tcp://6.0.1.1/1234", *appns_id = 0; u64 tmp, total_bytes, appns_flags = 0, appns_secret = 0; f64 test_timeout = 20.0, syn_timeout = 20.0, delta; + char *default_uri = "tcp://6.0.1.1/1234"; + uword *event_data = 0, event_type; f64 time_before_connects; u32 n_clients = 1; int preallocate_sessions = 0; char *transfer_type; clib_error_t *error = 0; + u8 *appns_id = 0; int i; ecm->bytes_to_send = 8192; @@ -644,8 +647,8 @@ echo_clients_command_fn (vlib_main_t * vm, if (!ecm->connect_uri) { - clib_warning ("No uri provided. Using default: %v", default_uri); - ecm->connect_uri = default_uri; + clib_warning ("No uri provided. Using default: %s", default_uri); + ecm->connect_uri = format (0, "%s%c", default_uri, 0); } #if ECHO_CLIENT_PTHREAD @@ -785,6 +788,7 @@ cleanup: } if (error) ec_cli_output ("test failed"); + vec_free (ecm->connect_uri); return error; } 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); diff --git a/src/vnet/tcp/tcp_debug.h b/src/vnet/tcp/tcp_debug.h index e0db7f4f0fa..5d4f7d6879d 100755 --- a/src/vnet/tcp/tcp_debug.h +++ b/src/vnet/tcp/tcp_debug.h @@ -19,7 +19,7 @@ #include <vlib/vlib.h> #define TCP_DEBUG (1) -#define TCP_DEBUG_SM (1) +#define TCP_DEBUG_SM (0) #define TCP_DEBUG_CC (0) #define TCP_DEBUG_CC_STAT (1) #define TCP_DEBUG_BUFFER_ALLOCATION (0) |