]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
mqtt: promote publish-error log paths to inform() for debuggability 2188/head
authorharreh3iesh <79946552+harreh3iesh@users.noreply.github.com>
Tue, 14 Apr 2026 23:50:59 +0000 (19:50 -0400)
committerharreh3iesh <79946552+harreh3iesh@users.noreply.github.com>
Wed, 15 Apr 2026 00:48:56 +0000 (20:48 -0400)
The two error branches in mqtt_publish() logged at debug(1), which is
invisible at default syslog verbosity. A silently-dropped MQTT publish
is the exact failure mode users report as 'MQTT just stopped working'
with no errors anywhere in the logs. Raising these to inform() makes
such drops legible at default verbosity and includes the target topic
plus mosquitto_strerror() text in the non-NO_CONN branch so the
diagnostic actually names the failing call site.

mqtt.c

diff --git a/mqtt.c b/mqtt.c
index 64cc1aa9c8fe95a58572ca4891e4898998a35f7c..35361e3909571a679e4081e93d8225b88945217c 100644 (file)
--- a/mqtt.c
+++ b/mqtt.c
@@ -259,10 +259,11 @@ void mqtt_publish(char *topic, char *data_in, uint32_t length_in) {
       MOSQ_ERR_SUCCESS) {
     switch (rc) {
     case MOSQ_ERR_NO_CONN:
-      debug(1, "[MQTT]: Publish failed: not connected to broker");
+      inform("[MQTT]: Publish to topic \"%s\" failed: not connected to broker", fulltopic);
       break;
     default:
-      debug(1, "[MQTT]: Publish failed: unknown error");
+      inform("[MQTT]: Publish to topic \"%s\" failed: %s (rc=%d)", fulltopic,
+             mosquitto_strerror(rc), rc);
       break;
     }
   }