diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-06-12 21:03:17 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-06-13 20:22:13 +0800 |
| commit | 3ad8cca9f6fecfb4c1f70f0a8c9d4b860f4c2df3 (patch) | |
| tree | 0e8dc3ed30eac7188714726e188a92ccfe2aa715 /src/session.hpp | |
| parent | e9f9065e4347ed5e99092612dd90fd85b622ad1c (diff) | |
internal!: refactored to smart pointer
Diffstat (limited to 'src/session.hpp')
| -rw-r--r-- | src/session.hpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/session.hpp b/src/session.hpp index 3ec04a3..2ca274e 100644 --- a/src/session.hpp +++ b/src/session.hpp @@ -30,7 +30,6 @@ class CSession { const std::string &getName() const; const std::string &getIp() const; bool isAdmin() const; - void setSelf(std::pair<std::jthread, std::shared_ptr<CSession>> *self); std::unique_ptr<SRecvData> read(); std::unique_ptr<SRecvData> read(const std::string &msg, bool bypassDeaf = false); @@ -58,14 +57,14 @@ class CSession { WRITE }; - std::pair<std::jthread, std::shared_ptr<CSession>> *self; - std::shared_ptr<CFileDescriptor> m_sockfd; - sockaddr_in m_addr; - socklen_t m_addrLen = sizeof(m_addr); - std::string m_name; - std::string m_ip; - int m_port; - bool m_isAdmin = false; + std::weak_ptr<CSession> self; + std::shared_ptr<CFileDescriptor> m_sockfd; + sockaddr_in m_addr; + socklen_t m_addrLen = sizeof(m_addr); + std::string m_name; + std::string m_ip; + int m_port; + bool m_isAdmin = false; std::optional<std::string> m_szReading = std::nullopt; bool m_bMuted = false; @@ -85,4 +84,5 @@ class CSession { #endif friend class CSessionManager; + friend void registerCommands(); }; |
