From a1cf3c42574ec30c1d6bb0b04aaed86163c73ed0 Mon Sep 17 00:00:00 2001 From: Laszlo Meszaros Date: Fri, 27 Nov 2015 10:52:09 +0100 Subject: [PATCH] zmq: added queue to source * ZMQ contains flow-control itself * The queue is necessary to set path_options to not bother about acknowledgement * Previously there was a bug which ended in a segfault. After the first reload and message sending syslog-ng crashed because the bookmark wasn't set properly. --- modules/zmq/zmq-source.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/zmq/zmq-source.c b/modules/zmq/zmq-source.c index 8edbdb3..977ada3 100644 --- a/modules/zmq/zmq-source.c +++ b/modules/zmq/zmq-source.c @@ -21,6 +21,7 @@ * */ + #include #include "zmq-module.h" @@ -225,6 +226,14 @@ zmq_sd_free(LogPipe *s) log_src_driver_free(s); } +static void +zmq_sd_queue(LogPipe *s, LogMessage *msg, const LogPathOptions *path_options, gpointer user_data) +{ + LogPathOptions *path_opt = path_options; + path_opt->ack_needed = FALSE; + log_src_driver_queue_method(s, msg, path_opt, user_data); +} + LogDriver * zmq_sd_new(GlobalConfig *cfg) { @@ -233,6 +242,7 @@ zmq_sd_new(GlobalConfig *cfg) log_src_driver_init_instance(&self->super, cfg); self->super.super.super.init = zmq_sd_init; + self->super.super.super.queue = zmq_sd_queue; self->super.super.super.deinit = zmq_sd_deinit; self->super.super.super.notify = zmq_sd_notify; self->super.super.super.free_fn = zmq_sd_free;