Use if/else instead of continue in client loop

This commit is contained in:
J. Nick Koston
2026-02-09 20:42:25 -06:00
parent 0c62781539
commit a671f6ea85

View File

@@ -148,16 +148,14 @@ void APIServer::loop() {
while (client_index < this->clients_.size()) {
auto &client = this->clients_[client_index];
if (!client->flags_.remove) {
if (client->flags_.remove) {
// Rare case: handle disconnection (don't increment - swapped element needs processing)
this->remove_client_(client_index);
} else {
// Common case: process active client
client->loop();
client_index++;
continue;
}
// Rare case: handle disconnection
this->remove_client_(client_index);
// Don't increment client_index since we need to process the swapped element
}
}