Decreased the scope of read mutex

This commit is contained in:
Anonymous-275
2021-03-31 00:05:05 +03:00
parent 24994d7dde
commit f323d50e34
6 changed files with 97 additions and 64 deletions

View File

@@ -99,6 +99,7 @@ THeartbeatThread::THeartbeatThread(TResourceManager& ResourceManager, TServer& S
std::string THeartbeatThread::GetPlayers() {
std::string Return;
mServer.ForEachClient([&](const std::weak_ptr<TClient>& ClientPtr) -> bool {
ReadLock Lock(mServer.GetClientMutex());
if (!ClientPtr.expired()) {
Return += ClientPtr.lock()->GetName() + ";";
}