Core/Misc: Use std::scoped_lock instead of unique_lock where possible (and old lock_guard)

This commit is contained in:
Shauren
2025-11-30 14:25:32 +01:00
parent d3f2aee245
commit 90be8fafb3
23 changed files with 92 additions and 106 deletions
+7 -10
View File
@@ -522,21 +522,18 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
LogoutPlayer(true);
///- Cleanup socket pointer if need
if ((m_Socket[CONNECTION_TYPE_REALM] && !m_Socket[CONNECTION_TYPE_REALM]->IsOpen()) ||
(m_Socket[CONNECTION_TYPE_INSTANCE] && !m_Socket[CONNECTION_TYPE_INSTANCE]->IsOpen()))
if (std::ranges::any_of(m_Socket, [](std::shared_ptr<WorldSocket> const& s) { return s && !s->IsOpen(); }))
{
expireTime -= expireTime > diff ? diff : expireTime;
if (expireTime < diff || forceExit || !GetPlayer())
{
if (m_Socket[CONNECTION_TYPE_REALM])
for (std::shared_ptr<WorldSocket>& socket : m_Socket)
{
m_Socket[CONNECTION_TYPE_REALM]->CloseSocket();
m_Socket[CONNECTION_TYPE_REALM].reset();
}
if (m_Socket[CONNECTION_TYPE_INSTANCE])
{
m_Socket[CONNECTION_TYPE_INSTANCE]->CloseSocket();
m_Socket[CONNECTION_TYPE_INSTANCE].reset();
if (socket)
{
socket->CloseSocket();
socket.reset();
}
}
}
}