summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 736260e)
raw | patch | inline | side by side (parent: 736260e)
author | Florian Forster <octo@collectd.org> | |
Fri, 11 Sep 2015 05:23:56 +0000 (07:23 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 11 Sep 2015 05:23:56 +0000 (07:23 +0200) |
D'oh!
Issue: #1262
Issue: #1262
src/mqtt.c | patch | blob | history |
diff --git a/src/mqtt.c b/src/mqtt.c
index 210d38cbef7d9b0fd89e2863eee88042bc3ebd2a..1b71d423d458109247e095cd8b5ce97de30b0ce4 100644 (file)
--- a/src/mqtt.c
+++ b/src/mqtt.c
{
char errbuf[1024];
c_complain (LOG_ERR,
- &conf->complaint_cantpublish,
- "plugin mqtt: mosquitto_publish failed: %s",
- status == MOSQ_ERR_ERRNO ?
- sstrerror(errno, errbuf, sizeof (errbuf)) :
- mosquitto_strerror(status));
+ &conf->complaint_cantpublish,
+ "mqtt plugin: mosquitto_publish failed: %s",
+ (status == MOSQ_ERR_ERRNO)
+ ? sstrerror(errno, errbuf, sizeof (errbuf))
+ : mosquitto_strerror(status));
/* Mark our connection "down" regardless of the error as a safety
* measure; we will try to reconnect the next time we have to publish a
* message */
conf->topic_prefix = strdup (MQTT_DEFAULT_TOPIC_PREFIX);
conf->store_rates = 1;
+ status = pthread_mutex_init (&conf->lock, NULL);
+ if (status != 0)
+ {
+ mqtt_free (conf);
+ return (status);
+ }
+
C_COMPLAIN_INIT (&conf->complaint_cantpublish);
for (i = 0; i < ci->children_num; i++)
conf->topic = strdup (MQTT_DEFAULT_TOPIC);
conf->clean_session = 1;
+ status = pthread_mutex_init (&conf->lock, NULL);
+ if (status != 0)
+ {
+ mqtt_free (conf);
+ return (status);
+ }
+
C_COMPLAIN_INIT (&conf->complaint_cantpublish);
for (i = 0; i < ci->children_num; i++)