Commit 23eea7833ff2a5b629e0c603237a4955911699ea
1 parent
1ae60863
Handle packets of disconnected clients
This fixes not handling the last packet(s) of a client that disconnects.
Showing
1 changed file
with
5 additions
and
5 deletions
threadloop.cpp
| ... | ... | @@ -108,17 +108,17 @@ void do_thread_work(ThreadData *threadData) |
| 108 | 108 | bool readSuccess = client->readFdIntoBuffer(); |
| 109 | 109 | client->bufferToMqttPackets(packetQueueIn, client); |
| 110 | 110 | |
| 111 | + for (MqttPacket &packet : packetQueueIn) | |
| 112 | + { | |
| 113 | + packet.handle(); | |
| 114 | + } | |
| 115 | + | |
| 111 | 116 | if (!readSuccess) |
| 112 | 117 | { |
| 113 | 118 | client->setDisconnectReason("socket disconnect detected"); |
| 114 | 119 | threadData->removeClient(client); |
| 115 | 120 | continue; |
| 116 | 121 | } |
| 117 | - | |
| 118 | - for (MqttPacket &packet : packetQueueIn) | |
| 119 | - { | |
| 120 | - packet.handle(); | |
| 121 | - } | |
| 122 | 122 | } |
| 123 | 123 | if ((cur_ev.events & EPOLLOUT) || ((cur_ev.events & EPOLLIN) && client->getSslWriteWantsRead())) |
| 124 | 124 | { | ... | ... |