패킷 정의, 로그가 더 많이 설명하도록 변경

This commit is contained in:
2025-04-30 20:13:20 +09:00
parent b662823726
commit af414e58a1
9 changed files with 222 additions and 12 deletions

View File

@@ -3,9 +3,11 @@
namespace Chattr {
Session::Session() {
init();
}
Session::~Session() {
destruct();
}
bool Session::init() {

View File

@@ -35,9 +35,11 @@ void Socket::destruct() {
#endif
}
Socket::operator SOCKET() const {
if (valid_)
Socket::operator SOCKET() {
if (valid_) {
valid_ = false;
return sock_;
}
spdlog::critical("No valid socket created.");
return INVALID_SOCKET;
}

View File

@@ -7,12 +7,14 @@ ThreadPool::ThreadPool(std::uint32_t numThreads) {
int numCPU = numThreads;
if (numThreads == 0) {
#ifdef _WIN32
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
numCPU = sysinfo.dwNumberOfProcessors;
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
numCPU = sysinfo.dwNumberOfProcessors;
#elif __linux__
numCPU = sysconf(_SC_NPROCESSORS_ONLN);
numCPU = sysconf(_SC_NPROCESSORS_ONLN);
#endif
spdlog::info("Auto-detected cpu count: {}", numCPU);
spdlog::info("Setting ThreadPool Worker count to: {}", numCPU);
}
workers_.reserve(numCPU);