aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/vcl_event.c15
-rw-r--r--src/vcl/vcl_event.h10
-rw-r--r--src/vcl/vppcom.c3
3 files changed, 27 insertions, 1 deletions
diff --git a/src/vcl/vcl_event.c b/src/vcl/vcl_event.c
index 65d28707607..64f55b9fb0b 100644
--- a/src/vcl/vcl_event.c
+++ b/src/vcl/vcl_event.c
@@ -80,6 +80,21 @@ vce_get_event_from_index(vce_event_thread_t *evt, u32 ev_idx)
}
vce_event_handler_reg_t *
+vce_get_event_handler (vce_event_thread_t *evt, vce_event_key_t *evk)
+{
+ vce_event_handler_reg_t *handler = 0;
+ uword *p;
+
+ clib_spinlock_lock (&evt->handlers_lockp);
+ p = hash_get (evt->handlers_index_by_event_key, evk->as_u64);
+ if (p)
+ handler = pool_elt_at_index (evt->vce_event_handlers, p[0]);
+ clib_spinlock_unlock (&evt->handlers_lockp);
+
+ return handler;
+}
+
+vce_event_handler_reg_t *
vce_register_handler (vce_event_thread_t *evt, vce_event_key_t *evk,
vce_event_callback_t cb)
{
diff --git a/src/vcl/vcl_event.h b/src/vcl/vcl_event.h
index 7b64ede6ae1..a2e247e8d7c 100644
--- a/src/vcl/vcl_event.h
+++ b/src/vcl/vcl_event.h
@@ -101,6 +101,16 @@ void vce_clear_event (vce_event_thread_t *evt, vce_event_t *ev);
vce_event_t * vce_get_event_from_index(vce_event_thread_t *evt, u32 ev_idx);
/**
+ * @brief vce_get_event_handler()
+ * - returns handler if exists or 0
+ * @param evt - vce_event_thread_t - event system state
+ * @param evk - event key
+ * @return vce_event_handler_reg_t *
+ */
+vce_event_handler_reg_t * vce_get_event_handler (vce_event_thread_t *evt,
+ vce_event_key_t *evk);
+
+/**
* @brief vce_register_handler
* - used by functions who need to be notified that an event has occurred
* on a vce_event_key_t (i.e. event type (enum) and sessionID)
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 1f9857676e2..4dea4aa3292 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -2754,7 +2754,8 @@ vppcom_session_accept (uint32_t listen_session_index, vppcom_endpt_t * ep,
reg = vce_register_handler (&vcm->event_thread, &evk,
vce_connect_request_handler_fn);
- ev = 0;
+ ev = vce_get_event_from_index (&vcm->event_thread, reg->ev_idx);
+
pthread_mutex_lock (&reg->handler_lock);
while (!ev)
{