]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
vici: Only log messages if there actually is a listener
authorTobias Brunner <tobias@strongswan.org>
Mon, 13 Feb 2017 16:38:49 +0000 (17:38 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 16 Feb 2017 18:24:09 +0000 (19:24 +0100)
src/libcharon/plugins/vici/vici_logger.c

index 6d3584ebd90653c1037d46527f2a304d33a60198..8e7bcfa1c5c2097e525a8685971999eb4bd5a853 100644 (file)
@@ -95,6 +95,11 @@ METHOD(logger_t, log_, void,
        private_vici_logger_t *this, debug_t group, level_t level, int thread,
        ike_sa_t* ike_sa, const char *msg)
 {
+       if (!this->dispatcher->has_event_listeners(this->dispatcher, "log"))
+       {
+               return;
+       }
+
        this->mutex->lock(this->mutex);
 
        /* avoid recursive invocations by the vici subsystem */
@@ -130,6 +135,8 @@ METHOD(logger_t, log_, void,
 METHOD(logger_t, get_level, level_t,
        private_vici_logger_t *this, debug_t group)
 {
+       /* anything higher might produce a loop as sending messages or listening
+        * for clients might cause log messages itself */
        return LEVEL_CTRL;
 }