From 635843692e2006ec10a1304c40d9fb1ba4064d31 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 26 May 2021 11:57:50 +0100 Subject: [PATCH] MOSQ_EVT_TICK is now passed to plugins when `per_listener_settings` is true. --- ChangeLog.txt | 1 + src/plugin.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 4f6af3af..c3f49f9c 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -23,6 +23,7 @@ Broker: MOSQ_ERR_QUOTA_EXCEEDED to have the message be rejected. MQTT v5 clients using QoS 1 or 2 will receive the quota-exceeded reason code in the corresponding PUBACK/PUBREC. +- MOSQ_EVT_TICK is now passed to plugins when `per_listener_settings` is true. Client library: - Add MOSQ_OPT_DISABLE_SOCKETPAIR to allow the disabling of the socketpair diff --git a/src/plugin.c b/src/plugin.c index 6091b6f9..9a8adce3 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -204,10 +204,20 @@ void plugin__handle_tick(void) struct mosquitto_evt_tick event_data; struct mosquitto__callback *cb_base; struct mosquitto__security_options *opts; + int i; /* FIXME - set now_s and now_ns to avoid need for multiple time lookups */ if(db.config->per_listener_settings){ - /* FIXME - iterate over all listeners */ + for(i=0; ilistener_count; i++){ + opts = &db.config->listeners[i].security_options; + if(opts && opts->plugin_callbacks.tick){ + memset(&event_data, 0, sizeof(event_data)); + + DL_FOREACH(opts->plugin_callbacks.tick, cb_base){ + cb_base->cb(MOSQ_EVT_TICK, &event_data, cb_base->userdata); + } + } + } }else{ opts = &db.config->security_options; memset(&event_data, 0, sizeof(event_data));