Rewrite accept code to not use continue

This commit is contained in:
SaltySnail
2026-03-28 16:23:29 +01:00
parent b4b262196b
commit 75e9c52ce8

View File

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