diff options
author | Florin Coras <fcoras@cisco.com> | 2020-10-28 16:41:26 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-10-29 21:31:25 +0000 |
commit | 06ac4bbc3234d8538b12c5b7c101a3ee56616e2a (patch) | |
tree | 8a0f297614b80cb4492f66efaffc733d2671aa07 /src | |
parent | d6894568709b59625f03e92595e0686b05f2167a (diff) |
session: fix ct cleanup before full establishement
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I58fb0e05f62eae45818c23e8e148ff6758ba463a
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/unittest/session_test.c | 28 | ||||
-rw-r--r-- | src/vnet/session/application_local.c | 7 |
2 files changed, 32 insertions, 3 deletions
diff --git a/src/plugins/unittest/session_test.c b/src/plugins/unittest/session_test.c index 37b4dac244d..c152a8ac9da 100644 --- a/src/plugins/unittest/session_test.c +++ b/src/plugins/unittest/session_test.c @@ -376,7 +376,18 @@ session_test_endpoint_cfg (vlib_main_t * vm, unformat_input_t * input) /* wait for stuff to happen */ while (connected_session_index == ~0 && ++tries < 100) - vlib_process_suspend (vm, 100e-3); + { + vlib_worker_thread_barrier_release (vm); + vlib_process_suspend (vm, 100e-3); + vlib_worker_thread_barrier_sync (vm); + } + while (accepted_session_index == ~0 && ++tries < 100) + { + vlib_worker_thread_barrier_release (vm); + vlib_process_suspend (vm, 100e-3); + vlib_worker_thread_barrier_sync (vm); + } + clib_warning ("waited %.1f seconds for connections", tries / 10.0); SESSION_TEST ((connected_session_index != ~0), "session should exist"); SESSION_TEST ((connected_session_thread != ~0), "thread should exist"); @@ -422,7 +433,7 @@ session_test_endpoint_cfg (vlib_main_t * vm, unformat_input_t * input) static int session_test_namespace (vlib_main_t * vm, unformat_input_t * input) { - u64 options[APP_OPTIONS_N_OPTIONS], placeholder_secret = 1234; + u64 options[APP_OPTIONS_N_OPTIONS], placeholder_secret = 1234, tries; u32 server_index, server_st_index, server_local_st_index; u32 placeholder_port = 1234, client_index, server_wrk_index; u32 placeholder_api_context = 4321, placeholder_client_api_index = ~0; @@ -609,6 +620,19 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input) connect_args.sep.ip.ip4.as_u8[0] = 127; error = vnet_connect (&connect_args); SESSION_TEST ((error == 0), "client connect should not return error code"); + + /* wait for accept */ + if (vlib_num_workers ()) + { + tries = 0; + while (!placeholder_accept && ++tries < 100) + { + vlib_worker_thread_barrier_release (vm); + vlib_process_suspend (vm, 100e-3); + vlib_worker_thread_barrier_sync (vm); + } + } + SESSION_TEST ((placeholder_segment_count == 1), "should've received request to map new segment"); SESSION_TEST ((placeholder_accept == 1), diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c index 9de987d7c31..dc777562d00 100644 --- a/src/vnet/session/application_local.c +++ b/src/vnet/session/application_local.c @@ -274,6 +274,7 @@ ct_accept_rpc_wrk_handler (void *accept_args) clib_memcpy (&cct->c_rmt_ip, &args->ip, sizeof (args->ip)); cct->actual_tp = ll_ct->actual_tp; cct->is_client = 1; + cct->c_s_index = ~0; /* * Init server transport @@ -465,7 +466,11 @@ ct_session_close (u32 ct_index, u32 thread_index) if (peer_ct) { peer_ct->peer_index = ~0; - session_transport_closing_notify (&peer_ct->connection); + /* Make sure session was allocated */ + if (peer_ct->c_s_index != ~0) + session_transport_closing_notify (&peer_ct->connection); + else + ct_connection_free (peer_ct); } s = session_get (ct->c_s_index, ct->c_thread_index); |