fix slowness round 2 and fix socket down detection
This commit is contained in:
@@ -116,8 +116,6 @@ inline void run_with_deadline(boost::asio::io_context &io_ctx,
|
||||
|
||||
timer.cancel();
|
||||
|
||||
io_ctx.poll();
|
||||
|
||||
if (state->timed_out) {
|
||||
repertory::event_system::instance().raise<repertory::packet_client_timeout>(
|
||||
std::string(event_name), std::string(function_name));
|
||||
|
@@ -45,6 +45,10 @@ auto is_socket_still_alive(boost::asio::ip::tcp::socket &sock) -> bool {
|
||||
non_blocking_guard guard{sock};
|
||||
|
||||
boost::system::error_code err{};
|
||||
std::array<std::uint8_t, 1> tmp{};
|
||||
[[maybe_unused]] auto available = sock.receive(
|
||||
boost::asio::buffer(tmp), boost::asio::socket_base::message_peek, err);
|
||||
|
||||
if (err == boost::asio::error::would_block ||
|
||||
err == boost::asio::error::try_again) {
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user