diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-03-04 23:39:03 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-03-04 23:39:03 +0800 |
| commit | b8228c249975306f1d35a43d79a99d4c6dc5f116 (patch) | |
| tree | aea632d177634d234f94efb9eadb661c66e39d28 /src/sessionManager.cpp | |
| parent | a93355a8e566aacfc289f6393dec247a17895afb (diff) | |
clang-format & clang-tidy
Diffstat (limited to 'src/sessionManager.cpp')
| -rw-r--r-- | src/sessionManager.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/sessionManager.cpp b/src/sessionManager.cpp index a249f61..d960aeb 100644 --- a/src/sessionManager.cpp +++ b/src/sessionManager.cpp @@ -1,29 +1,26 @@ #include "sessionManager.hpp" -#include "session.hpp" #include "server.hpp" +#include "session.hpp" #include <print> CSessionManager::CSessionManager() = default; CSessionManager::~CSessionManager() { - for (auto &[thread, session] : m_vSessions) { - thread.join(); - } + for (auto &[thread, session] : m_vSessions) + thread.join(); } void CSessionManager::newSession(Hyprutils::OS::CFileDescriptor sockfd) { - std::shared_ptr session = std::make_shared<CSession>(std::move(sockfd)); - m_vSessions.emplace_back(std::jthread(&CSession::run, session), std::move(session)); + std::shared_ptr session = std::make_shared<CSession>(std::move(sockfd)); + m_vSessions.emplace_back(std::jthread(&CSession::run, session), std::move(session)); } void CSessionManager::enterLoop() { - while (true) { - newSession(Hyprutils::OS::CFileDescriptor{accept(g_pServer->getSocket().take(), nullptr, nullptr) /* awaits new client/session */}); - } + while (true) + newSession(Hyprutils::OS::CFileDescriptor{accept(g_pServer->getSocket().take(), nullptr, nullptr) /* awaits new client/session */}); } void CSessionManager::broadcast(const std::string &msg) const { - for (const auto &[thread, session] : m_vSessions) { - session->write(msg); - } + for (const auto &[thread, session] : m_vSessions) + session->write(msg); } |
