diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-03-13 18:55:17 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-03-20 23:45:00 +0800 |
| commit | 95fe8f6c660a1c3bf91b5ab78f95ef0c35d8990c (patch) | |
| tree | 693c755b3050a7d62dfe4266e701c0edb2fbffd4 /src/session.hpp | |
| parent | 80ba94e84ed4f402862725bff3569e5bc563f5ea (diff) | |
perf(session): use pointer for SRecvData
Diffstat (limited to 'src/session.hpp')
| -rw-r--r-- | src/session.hpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/session.hpp b/src/session.hpp index 4f5adb2..65aa7a0 100644 --- a/src/session.hpp +++ b/src/session.hpp @@ -13,16 +13,15 @@ class CSession { ~CSession(); struct SRecvData { - char data[1024] = {0}; - ssize_t dataSize = sizeof(data); - bool good = true; + std::string data; + bool good = true; }; std::string getName(); - void setSelf(std::pair<std::jthread, std::shared_ptr<CSession>> *self); + void setSelf(std::pair<std::jthread, std::shared_ptr<CSession>> *self); - SRecvData read(); - SRecvData read(const std::string &msg); + std::unique_ptr<SRecvData> read(); + std::unique_ptr<SRecvData> read(const std::string &msg); bool write(const std::string &msg); template <typename... Args> bool write(std::format_string<Args...> fmt, Args &&...args); |
