diff --git a/src/TNetwork.cpp b/src/TNetwork.cpp index 02fb55b..9c88dea 100644 --- a/src/TNetwork.cpp +++ b/src/TNetwork.cpp @@ -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()); }