Code

mqtt plugin: Increase keepalive interval to 60s.
authorFlorian Forster <octo@collectd.org>
Fri, 3 Jul 2015 08:43:38 +0000 (10:43 +0200)
committerFlorian Forster <octo@collectd.org>
Mon, 6 Jul 2015 12:07:11 +0000 (14:07 +0200)
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

index 7f785dc86b8a89249141ea37a3866e45cd23978f..98b1751db7fafcc9b537aeca7ac2efa95df21465 100644 (file)
 #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];