summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tests/vnet/session/tcp_echo.c19
-rw-r--r--src/vnet/session/session_node.c18
2 files changed, 17 insertions, 20 deletions
diff --git a/src/tests/vnet/session/tcp_echo.c b/src/tests/vnet/session/tcp_echo.c
index 6e41e4b2c1a..626ef847e16 100644
--- a/src/tests/vnet/session/tcp_echo.c
+++ b/src/tests/vnet/session/tcp_echo.c
@@ -881,20 +881,16 @@ session_disconnected_handler (session_disconnected_msg_t * mp)
int rv = 0;
p = hash_get (em->session_index_by_vpp_handles, mp->handle);
-
- if (p)
- {
- clib_warning ("disconnected");
- session = pool_elt_at_index (em->sessions, p[0]);
- hash_unset (em->session_index_by_vpp_handles, mp->handle);
- pool_put (em->sessions, session);
- }
- else
+ if (!p)
{
clib_warning ("couldn't find session key %llx", mp->handle);
- rv = -11;
+ return;
}
+ session = pool_elt_at_index (em->sessions, p[0]);
+ hash_unset (em->session_index_by_vpp_handles, mp->handle);
+ pool_put (em->sessions, session);
+
app_alloc_ctrl_evt_to_vpp (session->vpp_evt_q, app_evt,
SESSION_CTRL_EVT_DISCONNECTED_REPLY);
rmp = (session_disconnected_reply_msg_t *) app_evt->evt->data;
@@ -903,8 +899,7 @@ session_disconnected_handler (session_disconnected_msg_t * mp)
rmp->context = mp->context;
app_send_ctrl_evt_to_vpp (session->vpp_evt_q, app_evt);
- if (session)
- session_print_stats (em, session);
+ session_print_stats (em, session);
}
static void
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index bf0c3959471..1ae92edf1ea 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -112,22 +112,24 @@ session_mq_disconnected_handler (void *data)
svm_msg_q_msg_t _msg, *msg = &_msg;
session_disconnected_msg_t *mp;
session_event_t *evt;
+ stream_session_t *s;
application_t *app;
int rv = 0;
mp = (session_disconnected_msg_t *) data;
app = application_lookup (mp->client_index);
- if (app)
+ s = session_get_from_handle_if_valid (mp->handle);
+ if (!(app && s && s->app_index == app->index))
{
- a->handle = mp->handle;
- a->app_index = app->index;
- rv = vnet_disconnect_session (a);
- }
- else
- {
- rv = VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
+ clib_warning ("could not disconnect session: %llu app: %u", mp->handle,
+ mp->client_index);
+ return;
}
+ a->handle = mp->handle;
+ a->app_index = app->index;
+ rv = vnet_disconnect_session (a);
+
svm_msg_q_lock_and_alloc_msg_w_ring (app->event_queue,
SESSION_MQ_CTRL_EVT_RING,
SVM_Q_WAIT, msg);