summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-11-27 10:45:55 -0800
committerDave Barach <openvpp@barachs.net>2021-11-29 17:49:48 +0000
commitdfd27bc0f2bf8e95feec055de5e7a9b19a496bec (patch)
tree62c5b6093acad8bfefdcbd0dfc195a99e1829f58 /src/vnet
parentb779ca9324a6bd2dd605e578b3ca9a4bb90bfa03 (diff)
session: postpone close notification if still accepting
Acceping sessions might be rejected so the notification might not make sense. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3ababdce7c2cec62941d9722a9c06fa48ec547db
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/session/session.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index f063548dcfe..f4a9e456454 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -1099,6 +1099,15 @@ session_transport_closing_notify (transport_connection_t * tc)
s = session_get (tc->s_index, tc->thread_index);
if (s->session_state >= SESSION_STATE_TRANSPORT_CLOSING)
return;
+
+ /* Wait for reply from app before sending notification as the
+ * accept might be rejected */
+ if (s->session_state == SESSION_STATE_ACCEPTING)
+ {
+ s->session_state = SESSION_STATE_TRANSPORT_CLOSING;
+ return;
+ }
+
s->session_state = SESSION_STATE_TRANSPORT_CLOSING;
app_wrk = app_worker_get (s->app_wrk_index);
app_worker_close_notify (app_wrk, s);
@@ -1225,6 +1234,11 @@ session_transport_reset_notify (transport_connection_t * tc)
svm_fifo_dequeue_drop_all (s->tx_fifo);
if (s->session_state >= SESSION_STATE_TRANSPORT_CLOSING)
return;
+ if (s->session_state == SESSION_STATE_ACCEPTING)
+ {
+ s->session_state = SESSION_STATE_TRANSPORT_CLOSING;
+ return;
+ }
s->session_state = SESSION_STATE_TRANSPORT_CLOSING;
app_wrk = app_worker_get (s->app_wrk_index);
app_worker_reset_notify (app_wrk, s);