From 40b0765c2180eba24d1bb4740b5a08754052ab89 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 3 Jul 2015 10:43:38 +0200 Subject: [PATCH] mqtt plugin: Increase keepalive interval to 60s. This is the default used by the Mosquitto tools. The new define makes it possible to easily override this at compile time. --- src/mqtt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mqtt.c b/src/mqtt.c index 7f785dc8..98b1751d 100644 --- a/src/mqtt.c +++ b/src/mqtt.c @@ -45,6 +45,10 @@ #define MQTT_DEFAULT_PORT 1883 #define MQTT_DEFAULT_TOPIC_PREFIX "collectd" #define MQTT_DEFAULT_TOPIC "collectd/#" +#ifndef MQTT_KEEPALIVE +# define MQTT_KEEPALIVE 60 +#endif + /* * Data types @@ -277,7 +281,7 @@ static int mqtt_connect (mqtt_client_conf_t *conf) } status = mosquitto_connect (conf->mosq, conf->host, conf->port, - /* keepalive = */ 10, /* clean session = */ conf->clean_session); + /* keepalive = */ MQTT_KEEPALIVE, /* clean session = */ conf->clean_session); if (status != MOSQ_ERR_SUCCESS) { char errbuf[1024]; -- 2.30.2