This commit is contained in:
2025-09-20 23:32:35 -05:00
parent 660cbb44e6
commit 1bdb8cb381

View File

@@ -98,7 +98,7 @@ struct non_blocking_guard final {
}
template <class op_t, class cancel_t>
void run_with_deadline(net::io_context &io_ctx, op_t &&operation,
void run_with_deadline(boost::asio::io_context &io_ctx, op_t &&operation,
cancel_t &&cancel_op, std::chrono::milliseconds deadline,
std::string_view timeout_event_tag,
std::string_view op_name,
@@ -108,7 +108,7 @@ void run_with_deadline(net::io_context &io_ctx, op_t &&operation,
bool done = false;
bool timed_out = false;
net::steady_timer timer{io_ctx};
boost::asio::steady_timer timer{io_ctx};
timer.expires_after(deadline);
timer.async_wait(
[&cancel_op, &done, &timed_out](const boost::system::error_code &err_) {
@@ -141,7 +141,7 @@ void run_with_deadline(net::io_context &io_ctx, op_t &&operation,
}
}
void connect_with_deadline(net::io_context &io_ctx,
void connect_with_deadline(boost::asio::io_context &io_ctx,
boost::asio::ip::tcp::socket &sock,
const auto &endpoints,
std::chrono::milliseconds deadline) {
@@ -150,14 +150,14 @@ void connect_with_deadline(net::io_context &io_ctx,
run_with_deadline(
io_ctx,
[&sock, &endpoints](auto &&handler) {
net::async_connect(sock, endpoints,
[handler](auto &&err, auto &&) { handler(err); });
boost::asio::async_connect(
sock, endpoints, [handler](auto &&err, auto &&) { handler(err); });
},
[&sock]() { sock.cancel(); }, deadline, "connect", "connect",
function_name);
}
void read_exact_with_deadline(net::io_context &io_ctx,
void read_exact_with_deadline(boost::asio::io_context &io_ctx,
boost::asio::ip::tcp::socket &sock,
boost::asio::mutable_buffer buf,
std::chrono::milliseconds deadline) {
@@ -175,7 +175,7 @@ void read_exact_with_deadline(net::io_context &io_ctx,
io_ctx,
[&](auto &&handler) {
sock.async_read_some(
net::buffer(base + offset, total - offset),
boost::asio::buffer(base + offset, total - offset),
[&bytes_read, handler](auto &&err, auto &&count) {
bytes_read = count;
handler(err);
@@ -192,7 +192,7 @@ void read_exact_with_deadline(net::io_context &io_ctx,
}
}
void write_all_with_deadline(net::io_context &io_ctx,
void write_all_with_deadline(boost::asio::io_context &io_ctx,
boost::asio::ip::tcp::socket &sock,
boost::asio::mutable_buffer buf,
std::chrono::milliseconds deadline) {
@@ -209,7 +209,7 @@ void write_all_with_deadline(net::io_context &io_ctx,
io_ctx,
[&](auto &&handler) {
sock.async_write_some(
net::buffer(base + offset, total - offset),
boost::asio::buffer(base + offset, total - offset),
[&bytes_written, handler](auto &&err, auto &&count) {
bytes_written = count;
handler(err);