From: Florian Forster Date: Fri, 3 Jul 2015 08:43:38 +0000 (+0200) Subject: mqtt plugin: Increase keepalive interval to 60s. X-Git-Tag: collectd-5.6.0~637^2~6 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=40b0765c2180eba24d1bb4740b5a08754052ab89;p=collectd.git 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. --- 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];