From 23eea7833ff2a5b629e0c603237a4955911699ea Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Tue, 22 Feb 2022 21:48:12 +0100 Subject: [PATCH] Handle packets of disconnected clients --- threadloop.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/threadloop.cpp b/threadloop.cpp index 5143a58..4800370 100644 --- a/threadloop.cpp +++ b/threadloop.cpp @@ -108,17 +108,17 @@ void do_thread_work(ThreadData *threadData) bool readSuccess = client->readFdIntoBuffer(); client->bufferToMqttPackets(packetQueueIn, client); + for (MqttPacket &packet : packetQueueIn) + { + packet.handle(); + } + if (!readSuccess) { client->setDisconnectReason("socket disconnect detected"); threadData->removeClient(client); continue; } - - for (MqttPacket &packet : packetQueueIn) - { - packet.handle(); - } } if ((cur_ev.events & EPOLLOUT) || ((cur_ev.events & EPOLLIN) && client->getSslWriteWantsRead())) { -- libgit2 0.21.4