Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarUniverseServer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/game/StarUniverseServer.cpp')
-rw-r--r--source/game/StarUniverseServer.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/game/StarUniverseServer.cpp b/source/game/StarUniverseServer.cpp
index f2d8b3e..7927aae 100644
--- a/source/game/StarUniverseServer.cpp
+++ b/source/game/StarUniverseServer.cpp
@@ -473,10 +473,15 @@ bool UniverseServer::updatePlanetType(CelestialCoordinate const& coordinate, Str
return false;
}
-void UniverseServer::sendPacket(ConnectionId clientId, PacketPtr packet) {
+bool UniverseServer::sendPacket(ConnectionId clientId, PacketPtr packet) {
RecursiveMutexLocker locker(m_mainLock);
- if (m_clients.contains(clientId))
+ ReadLocker clientsLocker(m_clientsLock);
+ if (m_clients.contains(clientId)) {
+ clientsLocker.unlock();
m_connectionServer->sendPackets(clientId, {packet});
+ return true;
+ }
+ return false;
}
void UniverseServer::run() {