fix:尝试修正某个客户端崩溃导致与其传输的客户端也崩溃的问题。

This commit is contained in:
taynpg 2024-12-19 16:59:50 +08:00
parent ef82c2721e
commit a486b31e4e

View File

@ -274,12 +274,18 @@ bool CTcpServer::send_frame(std::shared_ptr<asio::ip::tcp::socket> socket, CFram
logger_->error("{} pack failed.", __FUNCTION__);
return false;
}
try {
if (!socket->send(asio::buffer(out_buf, out_len))) {
logger_->error("{} send failed, buf type:{}, fid:{}, tid:{}", __FUNCTION__,
static_cast<int>(buf->type_), buf->fid_, buf->tid_);
delete[] out_buf;
return false;
}
} catch (const std::exception& e) {
logger_->error("send failed, type:{}, fid:{}, tid:{}, mark:{}", static_cast<int>(buf->type_),
buf->fid_, buf->tid_, buf->mark_);
}
delete[] out_buf;
return true;
}