fix:修正锁释放位置。
This commit is contained in:
parent
9be2818f5c
commit
b7eb7cd974
@ -100,11 +100,12 @@ void CTcpServer::handle_frame()
|
|||||||
if (cache_.size() > 0) {
|
if (cache_.size() > 0) {
|
||||||
buf = cache_.front();
|
buf = cache_.front();
|
||||||
cache_.pop();
|
cache_.pop();
|
||||||
} else {
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!buf) {
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 拿到该包后,要看转发给谁或者处理
|
// 拿到该包后,要看转发给谁或者处理
|
||||||
if (buf->type_ == 199) { // 询问在线客户端
|
if (buf->type_ == 199) { // 询问在线客户端
|
||||||
@ -130,11 +131,13 @@ void CTcpServer::send_simple_buf()
|
|||||||
if (scache_.size() > 0) {
|
if (scache_.size() > 0) {
|
||||||
buf = scache_.front();
|
buf = scache_.front();
|
||||||
scache_.pop();
|
scache_.pop();
|
||||||
} else {
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!buf) {
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<asio::ip::tcp::socket> socket = nullptr;
|
std::shared_ptr<asio::ip::tcp::socket> socket = nullptr;
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> clock(cli_mut_);
|
std::lock_guard<std::mutex> clock(cli_mut_);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user