diff --git a/ChangeLog.txt b/ChangeLog.txt index bfb4a856..1dfe7edf 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,12 @@ 1.5.4 - 201810xx ================ +Broker: +- Process all pending messages even when a client has disconnected. This means + a client that send a PUBLISH then DISCONNECT quickly, then disconnects will + have its DISCONNECT message processed properly and so no Will will be sent. + Closes #7. + Library: - Fix memory leak that occurred if mosquitto_reconnect() was used when TLS errors were present. Closes #592. diff --git a/src/loop.c b/src/loop.c index 002fb24f..c0de5433 100644 --- a/src/loop.c +++ b/src/loop.c @@ -813,14 +813,15 @@ static void loop_handle_reads_writes(struct mosquitto_db *db, struct pollfd *pol continue; } }while(SSL_DATA_PENDING(context)); - } + }else{ #ifdef WITH_EPOLL - if(events & (EPOLLERR | EPOLLHUP)){ + if(events & (EPOLLERR | EPOLLHUP)){ #else - if(context->pollfd_index >= 0 && pollfds[context->pollfd_index].revents & (POLLERR | POLLNVAL | POLLHUP)){ + if(context->pollfd_index >= 0 && pollfds[context->pollfd_index].revents & (POLLERR | POLLNVAL | POLLHUP)){ #endif - do_disconnect(db, context); - continue; + do_disconnect(db, context); + continue; + } } } }