fix: stop token으로 변경되어 필요없는 flag 제거
This commit is contained in:
parent
e9209b54cf
commit
9f5fe4ede7
2 changed files with 1 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue