From 9f5fe4ede7ce44c7263b21558e6c6e5b8ce0d750 Mon Sep 17 00:00:00 2001 From: bumpsoo Date: Thu, 5 Feb 2026 13:37:00 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20stop=20token=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=EB=90=98=EC=96=B4=20=ED=95=84=EC=9A=94?= =?UTF-8?q?=EC=97=86=EB=8A=94=20flag=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/Client.cpp | 4 +--- include/Client.h | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/client/Client.cpp b/client/Client.cpp index b8efb0c..3c7f413 100644 --- a/client/Client.cpp +++ b/client/Client.cpp @@ -68,12 +68,10 @@ bool BaseClient::Login(const std::string &nickname) { } void BaseClient::StartReceive() { - isRunning_ = true; receiveThread_ = std::jthread(&BaseClient::ReceiveLoop, this); } void BaseClient::StopReceive() { - isRunning_ = false; boost::system::error_code ec; socket_.shutdown(tcp::socket::shutdown_both, ec); socket_.close(ec); @@ -82,7 +80,7 @@ void BaseClient::StopReceive() { void BaseClient::ReceiveLoop(std::stop_token stopToken) { try { - while (!stopToken.stop_requested() && isRunning_) { + while (!stopToken.stop_requested()) { PacketHeader header; if (!ReceiveHeader(header)) break; diff --git a/include/Client.h b/include/Client.h index 3379ecd..b30f57d 100644 --- a/include/Client.h +++ b/include/Client.h @@ -44,7 +44,6 @@ protected: std::string nickname_; std::jthread receiveThread_; - std::atomic isRunning_{false}; void ReceiveLoop(std::stop_token stopToken); void HandlePacket(const PacketHeader &header);