diff options
author | Florin Coras <fcoras@cisco.com> | 2021-11-25 12:14:25 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2021-11-26 21:47:37 +0000 |
commit | a7bd8264b81b726dcfdd99aec32f6142a6f7f056 (patch) | |
tree | 0400d1fa7c7ec1e9e239e9df856350e2cf4be9ab /src/vnet/session | |
parent | a4abdac55f474e9c1876444dcd6c4b461c25993d (diff) |
session: only notify server on ct connect failure
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ifcb631ed2913e5f4fc318238de9100286a7990d2
Diffstat (limited to 'src/vnet/session')
-rw-r--r-- | src/vnet/session/application_local.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c index 8c17a15de53..05b946e40b8 100644 --- a/src/vnet/session/application_local.c +++ b/src/vnet/session/application_local.c @@ -322,6 +322,13 @@ done: clib_rwlock_writer_unlock (&cm->app_segs_lock); } +static void +ct_session_force_disconnect_server (ct_connection_t *sct) +{ + sct->peer_index = ~0; + session_transport_closing_notify (&sct->connection); +} + int ct_session_connect_notify (session_t *ss, session_error_t err) { @@ -341,9 +348,7 @@ ct_session_connect_notify (session_t *ss, session_error_t err) /* Client closed while waiting for reply from server */ if (PREDICT_FALSE (!cct)) { - session_transport_closing_notify (&sct->connection); - session_transport_delete_notify (&sct->connection); - ct_connection_free (sct); + ct_session_force_disconnect_server (sct); return 0; } @@ -354,9 +359,11 @@ ct_session_connect_notify (session_t *ss, session_error_t err) goto connect_error; /* - * Alloc client session + * Alloc client session, server session assumed to be established */ + ASSERT (ss->session_state >= SESSION_STATE_READY); + cs = session_alloc (thread_index); ss = session_get (ss_index, thread_index); cs->session_type = ss->session_type; @@ -372,7 +379,7 @@ ct_session_connect_notify (session_t *ss, session_error_t err) if ((err = app_worker_init_connected (client_wrk, cs))) { session_free (cs); - session_close (ss); + ct_session_force_disconnect_server (sct); err = SESSION_E_ALLOC; goto connect_error; } @@ -383,7 +390,7 @@ ct_session_connect_notify (session_t *ss, session_error_t err) { segment_manager_dealloc_fifos (cs->rx_fifo, cs->tx_fifo); session_free (cs); - session_close (ss); + ct_session_force_disconnect_server (sct); goto cleanup_client; } @@ -398,8 +405,6 @@ connect_error: cleanup_client: - sct->peer_index = ~0; - if (cct->client_rx_fifo) ct_session_dealloc_fifos (cct, cct->client_rx_fifo, cct->client_tx_fifo); ct_connection_free (cct); @@ -1068,6 +1073,7 @@ ct_session_close (u32 ct_index, u32 thread_index) if (peer_ct->flags & CT_CONN_F_HALF_OPEN) { ct_session_connect_notify (s, SESSION_E_REFUSED); + ct->peer_index = ~0; } else if (peer_ct->c_s_index != ~0) { |