Skip to content

Commit

Permalink
fix(ws): break loop after erasing client
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieucarbou committed Jan 28, 2025
1 parent 7be1742 commit 180b850
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/AsyncWebSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -916,11 +916,10 @@ void AsyncWebSocket::cleanupClients(uint16_t maxClients) {
_clients.front().close();
}

for (auto iter = std::begin(_clients); iter != std::end(_clients);) {
if (iter->shouldBeDeleted()) {
iter = _clients.erase(iter);
} else {
iter++;
for (auto i = _clients.begin(); i != _clients.end(); ++i) {
if (i->shouldBeDeleted()) {
_clients.erase(i);
break;
}
}
}
Expand Down

0 comments on commit 180b850

Please sign in to comment.