mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-02 22:06:26 +00:00
Rewrite accept code to not use continue
This commit is contained in:
@@ -241,12 +241,14 @@ void TNetwork::TCPServerMain() {
|
||||
}
|
||||
ip::tcp::endpoint ClientEp;
|
||||
ip::tcp::socket ClientSocket = Acceptor.accept(ClientEp, ec);
|
||||
if (ec) {
|
||||
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(); // TODO: Add to a queue and attempt to join periodically
|
||||
} catch (const std::exception& e) {
|
||||
beammp_errorf("Exception in accept routine: {}", e.what());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user