diff options
author | Florin Coras <fcoras@cisco.com> | 2021-11-09 10:42:43 -0800 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2021-11-09 19:09:22 +0000 |
commit | e7dda6b034b9b8dd56da71280a796e18d88a99bd (patch) | |
tree | b93476324391b9254cccc0808810170adab67c02 /src/vnet/session/application_local.c | |
parent | 440c7b55708050cc6a10ffaa19a44fb0c9ecf31f (diff) |
session: reset if ct close with data
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I9540948b8b5476af7558d741cbf15ee838d4e01b
Diffstat (limited to 'src/vnet/session/application_local.c')
-rw-r--r-- | src/vnet/session/application_local.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c index 88536dc27c6..f68567f7fd3 100644 --- a/src/vnet/session/application_local.c +++ b/src/vnet/session/application_local.c @@ -963,6 +963,15 @@ ct_program_cleanup (ct_connection_t *ct) thread_index, ct_handle_cleanups, uword_to_pointer (thread_index, void *)); } +static inline int +ct_close_is_reset (ct_connection_t *ct, session_t *s) +{ + if (ct->flags & CT_CONN_F_CLIENT) + return (svm_fifo_max_dequeue (ct->client_rx_fifo) > 0); + else + return (svm_fifo_max_dequeue (s->rx_fifo) > 0); +} + static void ct_session_close (u32 ct_index, u32 thread_index) { @@ -981,7 +990,12 @@ ct_session_close (u32 ct_index, u32 thread_index) ct_session_connect_notify (s, SESSION_E_REFUSED); } else if (peer_ct->c_s_index != ~0) - session_transport_closing_notify (&peer_ct->connection); + { + if (ct_close_is_reset (ct, s)) + session_transport_reset_notify (&peer_ct->connection); + else + session_transport_closing_notify (&peer_ct->connection); + } else { /* should not happen */ |