diff --git a/ChangeLog.txt b/ChangeLog.txt index fa5c44b47a..509a2fe47a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -6,6 +6,7 @@ Broker: - Fix websockets listeners with TLS not responding. Closes #2020. - Add notes that libsystemd-dev or similar is needed if building with systemd support. Closes #2019. +- Improve logging in obscure cases when a client disconnects. Closes #2017. Apps: - Allow command line arguments to override config file options in diff --git a/src/loop.c b/src/loop.c index aa1367d8e4..ba146c25a1 100644 --- a/src/loop.c +++ b/src/loop.c @@ -353,8 +353,11 @@ void do_disconnect(struct mosquitto *context, int reason) case MOSQ_ERR_ADMINISTRATIVE_ACTION: log__printf(NULL, MOSQ_LOG_NOTICE, "Client %s been disconnected by administrative action.", id); break; + case MOSQ_ERR_ERRNO: + log__printf(NULL, MOSQ_LOG_NOTICE, "Client %s disconnected: %s.", id, strerror(errno)); + break; default: - log__printf(NULL, MOSQ_LOG_NOTICE, "Bad socket read/write on client %s, disconnecting.", id); + log__printf(NULL, MOSQ_LOG_NOTICE, "Bad socket read/write on client %s: %s.", id, mosquitto_strerror(reason)); break; } }else{