diff --git a/main.cpp b/main.cpp index e0c4ac7..148db8d 100644 --- a/main.cpp +++ b/main.cpp @@ -45,15 +45,14 @@ void do_thread_work(ThreadData *threadData) { if (cur_ev.events & EPOLLIN) { - if (!client->readFdIntoBuffer()) + bool readSuccess = client->readFdIntoBuffer(); + client->bufferToMqttPackets(packetQueueIn, client); + + if (!readSuccess) { std::cout << "Disconnect: " << client->repr() << std::endl; threadData->removeClient(client); } - else - { - client->bufferToMqttPackets(packetQueueIn, client); - } } if (cur_ev.events & EPOLLOUT) {