fix:修正锁释放位置。

This commit is contained in:
taynpg 2024-12-13 12:39:34 +08:00
parent 9be2818f5c
commit b7eb7cd974

View File

@ -100,11 +100,12 @@ void CTcpServer::handle_frame()
if (cache_.size() > 0) {
buf = cache_.front();
cache_.pop();
} else {
}
}
if (!buf) {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
continue;
}
}
// 拿到该包后,要看转发给谁或者处理
if (buf->type_ == 199) { // 询问在线客户端
@ -130,11 +131,13 @@ void CTcpServer::send_simple_buf()
if (scache_.size() > 0) {
buf = scache_.front();
scache_.pop();
} else {
}
}
if (!buf) {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
continue;
}
}
std::shared_ptr<asio::ip::tcp::socket> socket = nullptr;
{
std::lock_guard<std::mutex> clock(cli_mut_);