summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_node.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-12-27 14:51:46 -0800
committerDave Barach <openvpp@barachs.net>2019-01-01 14:55:53 +0000
commitb0f662fe93f1db0098f7b50306c2f084644788b1 (patch)
treee70b7c9594391185c0c0b65f492a5ba931c4e69b /src/vnet/session/session_node.c
parent22af447454cf097ac4fc59f9072d805c371ab803 (diff)
vcl/ldp: add write msg function and fine tuning
Allows app to push data. Additionally, ensure reset/close replies are not sent unless vcl closes the session. Change-Id: Icbbf933cf57b55cfbcc7b802af0f83919a066f65 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/session_node.c')
-rw-r--r--src/vnet/session/session_node.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 4323ed83cf8..45018daf45a 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -29,6 +29,7 @@ session_mq_accepted_reply_handler (void *data)
{
session_accepted_reply_msg_t *mp = (session_accepted_reply_msg_t *) data;
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
+ stream_session_state_t old_state;
app_worker_t *app_wrk;
local_session_t *ls;
stream_session_t *s;
@@ -64,18 +65,29 @@ session_mq_accepted_reply_handler (void *data)
else
{
s = session_get_from_handle_if_valid (mp->handle);
- /* Closed while waiting for app to reply */
- if (!s || s->session_state > SESSION_STATE_READY)
+ if (!s)
return;
+
app_wrk = app_worker_get (s->app_wrk_index);
if (app_wrk->app_index != mp->context)
{
clib_warning ("app doesn't own session");
return;
}
+
+ old_state = s->session_state;
s->session_state = SESSION_STATE_READY;
if (!svm_fifo_is_empty (s->server_rx_fifo))
app_worker_lock_and_send_event (app_wrk, s, FIFO_EVENT_APP_RX);
+
+ /* Closed while waiting for app to reply. Resend disconnect */
+ if (old_state >= SESSION_STATE_TRANSPORT_CLOSING)
+ {
+ application_t *app = application_get (app_wrk->app_index);
+ app->cb_fns.session_disconnect_callback (s);
+ s->session_state = old_state;
+ return;
+ }
}
}