fix slowness round 2 and fix socket down detection

This commit is contained in:
2025-09-29 09:04:29 -05:00
parent 3da80fcf69
commit d6b38b9df0
2 changed files with 4 additions and 2 deletions

View File

@@ -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));

View File

@@ -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;