Update StarUniverseServer.cpp
This commit is contained in:
parent
f0a08aea22
commit
e3462c3c69
@ -1782,8 +1782,12 @@ void UniverseServer::acceptConnection(UniverseConnection connection, Maybe<HostA
|
|||||||
clientFlyShip(clientId, clientContext->shipCoordinate().location(), clientContext->shipLocation());
|
clientFlyShip(clientId, clientContext->shipCoordinate().location(), clientContext->shipLocation());
|
||||||
Logger::info("UniverseServer: Client {} connected", clientContext->descriptiveName());
|
Logger::info("UniverseServer: Client {} connected", clientContext->descriptiveName());
|
||||||
|
|
||||||
|
ReadLocker m_clientsReadLocker(m_clientsLock);
|
||||||
auto players = static_cast<uint16_t>(m_clients.size());
|
auto players = static_cast<uint16_t>(m_clients.size());
|
||||||
for (auto clientId : m_clients.keys()) {
|
auto clients = m_clients.keys();
|
||||||
|
m_clientsReadLocker.unlock();
|
||||||
|
|
||||||
|
for (auto clientId : clients) {
|
||||||
m_connectionServer->sendPackets(clientId, {
|
m_connectionServer->sendPackets(clientId, {
|
||||||
make_shared<ServerInfoPacket>(players, static_cast<uint16_t>(m_maxPlayers))
|
make_shared<ServerInfoPacket>(players, static_cast<uint16_t>(m_maxPlayers))
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user