fix:修正退出时关闭发送心跳包。
This commit is contained in:
parent
c176a2b182
commit
8dc6184348
@ -60,6 +60,8 @@ void CClient::run(const std::string& ip, const std::string& port)
|
|||||||
|
|
||||||
std::string cmd_input(line);
|
std::string cmd_input(line);
|
||||||
if (cmd_input == "end") {
|
if (cmd_input == "end") {
|
||||||
|
th_run_ = false;
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
auto vec = COfStr::split(cmd_input, " ");
|
auto vec = COfStr::split(cmd_input, " ");
|
||||||
@ -440,7 +442,7 @@ void CClient::hearts()
|
|||||||
buf->type_ = TYPE_HEARTS;
|
buf->type_ = TYPE_HEARTS;
|
||||||
while (th_run_) {
|
while (th_run_) {
|
||||||
sleep_.sleep();
|
sleep_.sleep();
|
||||||
if (!send_frame(buf.get())) {
|
if (th_run_ && !send_frame(buf.get())) {
|
||||||
logger_->error("{} send failed.", __FUNCTION__);
|
logger_->error("{} send failed.", __FUNCTION__);
|
||||||
th_run_ = false;
|
th_run_ = false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user