Fix skip invalid socket (#477)

Removes continue in socket accept flow

---

By creating this pull request, I understand that code that is AI
generated or otherwise automatically generated may be rejected without
further discussion.
I declare that I fully understand all code I pushed into this PR, and
wrote all this code myself and own the rights to this code.
This commit is contained in:
Tixx
2026-03-28 17:04:04 +01:00
committed by GitHub

View File

@@ -241,13 +241,14 @@ void TNetwork::TCPServerMain() {
}
ip::tcp::endpoint ClientEp;
ip::tcp::socket ClientSocket = Acceptor.accept(ClientEp, ec);
if (ec) {
beammp_errorf("Failed to accept() new client: {}", ec.message());
continue;
if (!ec) {
TConnection Conn { std::move(ClientSocket), ClientEp };
std::thread ID(&TNetwork::Identify, this, std::move(Conn));
ID.detach(); // TODO: Add to a queue and attempt to join periodically
}
else {
beammp_errorf("Failed to accept() new client: {}", ec.message());
}
TConnection Conn { std::move(ClientSocket), ClientEp };
std::thread ID(&TNetwork::Identify, this, std::move(Conn));
ID.detach();
} catch (const std::exception& e) {
beammp_errorf("Exception in accept routine: {}", e.what());
}