diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/sessionManager.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/sessionManager.cpp b/src/sessionManager.cpp index 801d9a7..51bede4 100644 --- a/src/sessionManager.cpp +++ b/src/sessionManager.cpp @@ -80,12 +80,11 @@ void CSessionManager::kick(CSession *session, const bool &kill, const std::strin } void CSessionManager::kick(std::pair<std::jthread, std::shared_ptr<CSession>> *session, const bool &kill, const std::string &reason) { - if (!reason.empty()) - session->second->write(reason); - auto it = std::ranges::find_if(m_vSessions, [session](const auto &s) { return s.second.get() == session->second.get(); }); if (it != m_vSessions.end()) { + if (!reason.empty()) + it->second->write(reason); const auto native_handle = it->first.native_handle(); if (it->first.joinable()) it->first.detach(); // .detach the thread since it's removing itself |
