fix seemingly extremely rare race condition leading to exception when joining a singleplayer internal server
happened when the client thread called universeServer->setPause (which locks m_clientsLock) between the client id being added to m_clients and the connection being added to m_connectionServer
This commit is contained in:
parent
4120a289db
commit
bb5387fbdb
@ -1679,6 +1679,7 @@ void UniverseServer::acceptConnection(UniverseConnection connection, Maybe<HostA
|
||||
auto clientContext = make_shared<ServerClientContext>(clientId, remoteAddress, clientConnect->playerUuid,
|
||||
clientConnect->playerName, clientConnect->playerSpecies, administrator, clientConnect->shipChunks);
|
||||
m_clients.add(clientId, clientContext);
|
||||
m_connectionServer->addConnection(clientId, std::move(connection));
|
||||
clientsLocker.unlock();
|
||||
|
||||
clientContext->registerRpcHandlers(m_teamManager->rpcHandlers());
|
||||
@ -1700,8 +1701,6 @@ void UniverseServer::acceptConnection(UniverseConnection connection, Maybe<HostA
|
||||
clientContext->setAdmin(false);
|
||||
|
||||
clientContext->setShipUpgrades(clientConnect->shipUpgrades);
|
||||
|
||||
m_connectionServer->addConnection(clientId, std::move(connection));
|
||||
m_chatProcessor->connectClient(clientId, clientConnect->playerName);
|
||||
|
||||
m_connectionServer->sendPackets(clientId, {
|
||||
|
Loading…
Reference in New Issue
Block a user