diff --git a/ChangeLog.txt b/ChangeLog.txt index 44faf4ef..54d16ff9 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -6,6 +6,8 @@ Broker: - Fix bridges potentially not connecting on Windows. Closes #478. - Fix clients authorised using `use_identity_as_username` or `use_subject_as_username` being disconnected on SIGHUP. Closes #1402. +- Improve error messages in some situations when clients disconnect. Reduces + the number of "Socket error on client X, disconnecting" messages. Client library: - Fix reconnect backoff for the situation where connections are dropped rather diff --git a/src/loop.c b/src/loop.c index 50959599..4e2e4c5c 100644 --- a/src/loop.c +++ b/src/loop.c @@ -709,6 +709,7 @@ static void loop_handle_reads_writes(struct mosquitto_db *db, struct pollfd *pol #endif int err; socklen_t len; + int rc; #ifdef WITH_EPOLL int i; @@ -780,8 +781,9 @@ static void loop_handle_reads_writes(struct mosquitto_db *db, struct pollfd *pol continue; } } - if(packet__write(context)){ - do_disconnect(db, context, MOSQ_ERR_CONN_LOST); + rc = packet__write(context); + if(rc){ + do_disconnect(db, context, rc); continue; } } @@ -822,8 +824,9 @@ static void loop_handle_reads_writes(struct mosquitto_db *db, struct pollfd *pol #endif #endif do{ - if(packet__read(db, context)){ - do_disconnect(db, context, MOSQ_ERR_CONN_LOST); + rc = packet__read(db, context); + if(rc){ + do_disconnect(db, context, rc); continue; } }while(SSL_DATA_PENDING(context));