projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #2168 from maryamtahhan/feat_libvirt_upstream
[collectd.git]
/
src
/
mqtt.c
diff --git
a/src/mqtt.c
b/src/mqtt.c
index
b578b99
..
a962514
100644
(file)
--- a/
src/mqtt.c
+++ b/
src/mqtt.c
@@
-448,6
+448,7
@@
static int publish(mqtt_client_conf_t *conf, char const *topic,
* measure; we will try to reconnect the next time we have to publish a
* message */
conf->connected = 0;
* measure; we will try to reconnect the next time we have to publish a
* message */
conf->connected = 0;
+ mosquitto_disconnect(conf->mosq);
pthread_mutex_unlock(&conf->lock);
return (-1);
pthread_mutex_unlock(&conf->lock);
return (-1);
@@
-461,6
+462,7
@@
static int format_topic(char *buf, size_t buf_len, data_set_t const *ds,
value_list_t const *vl, mqtt_client_conf_t *conf) {
char name[MQTT_MAX_TOPIC_SIZE];
int status;
value_list_t const *vl, mqtt_client_conf_t *conf) {
char name[MQTT_MAX_TOPIC_SIZE];
int status;
+ char *c;
if ((conf->topic_prefix == NULL) || (conf->topic_prefix[0] == 0))
return (FORMAT_VL(buf, buf_len, vl));
if ((conf->topic_prefix == NULL) || (conf->topic_prefix[0] == 0))
return (FORMAT_VL(buf, buf_len, vl));
@@
-473,6
+475,10
@@
static int format_topic(char *buf, size_t buf_len, data_set_t const *ds,
if ((status < 0) || (((size_t)status) >= buf_len))
return (ENOMEM);
if ((status < 0) || (((size_t)status) >= buf_len))
return (ENOMEM);
+ while((c = strchr(buf, '#')) || (c = strchr(buf, '+'))) {
+ *c = '_';
+ }
+
return (0);
} /* int format_topic */
return (0);
} /* int format_topic */
@@
-751,5
+757,3
@@
void module_register(void) {
plugin_register_complex_config("mqtt", mqtt_config);
plugin_register_init("mqtt", mqtt_init);
} /* void module_register */
plugin_register_complex_config("mqtt", mqtt_config);
plugin_register_init("mqtt", mqtt_init);
} /* void module_register */
-
-/* vim: set sw=4 sts=4 et fdm=marker : */