From f3d7c4fed67e3c16dc49e8a8306d17591c8a0d15 Mon Sep 17 00:00:00 2001 From: Zeiss-1000 observer Date: Sat, 17 Oct 2026 20:19:23 +0300 Subject: [PATCH] ... --- include/snipplib/network/snplib_network_asio.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/include/snipplib/network/snplib_network_asio.h b/include/snipplib/network/snplib_network_asio.h index 606ca00..2c1ab86 100644 --- a/include/snipplib/network/snplib_network_asio.h +++ b/include/snipplib/network/snplib_network_asio.h @@ -71,14 +71,12 @@ public: { auto msg_bytes = msg.toBytes(); auto net_bytes = _reprProto.toNetwork(msg_bytes); - if (net_bytes.flag != net_connection_t::net_repr_proto_t::result_flag_t::OK) { - } switch (net_bytes.flag) { case net_connection_t::net_repr_proto_t::result_flag_t::NOT_ENOUGH_DATA: - co_return std::errc::message_size; + co_return std::make_error_code(std::errc::message_size); case net_connection_t::net_repr_proto_t::result_flag_t::INVALID_DATA: - co_return std::errc::invalid_argument; + co_return std::make_error_code(std::errc::invalid_argument); default: break; } @@ -137,7 +135,14 @@ public: co_return ec; } - ::asio::awaitable recv() {} + ::asio::awaitable recv() + { + thread_local static ::asio::steady_timer timeout_timer(_socket.get_executor()); + + auto start_tp = std::chrono::steady_clock::now(); + + timeout_timer.expires_after(_recvTimeout); + } ::asio::awaitable close() {}