vici: Let has_event_listeners() actually check if clients are registered
authorTobias Brunner <tobias@strongswan.org>
Wed, 8 Feb 2017 14:20:58 +0000 (15:20 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 16 Feb 2017 18:24:09 +0000 (19:24 +0100)
Fixes: 8d96f90a7983 ("vici: Add function to test if an event should be
generated")

src/libcharon/plugins/vici/vici_dispatcher.c

index ffe0d61..596255b 100644 (file)
@@ -471,15 +471,17 @@ METHOD(vici_dispatcher_t, manage_event, void,
 METHOD(vici_dispatcher_t, has_event_listeners, bool,
        private_vici_dispatcher_t *this, char *name)
 {
+       event_t *event;
        bool retval = FALSE;
 
        this->mutex->lock(this->mutex);
-       if (this->events->get(this->events, name))
+       event = this->events->get(this->events, name);
+       if (event)
        {
                /* the entry might be getting destroyed, but returning
                 * false positive is not a problem as a later raise_event
                 * will check things again. */
-               retval = TRUE;
+               retval = array_count(event->clients);
        }
        this->mutex->unlock(this->mutex);