Skip to content

Commit

Permalink
Improve logging in obscure cases when a client disconnects.
Browse files Browse the repository at this point in the history
Closes #2017. Thanks to Craig Leres.
  • Loading branch information
ralight committed Jan 15, 2021
1 parent 9c4b9a0 commit e2ebddf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions ChangeLog.txt
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/loop.c
Expand Up @@ -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{
Expand Down

0 comments on commit e2ebddf

Please sign in to comment.