4#include <boost/asio/as_tuple.hpp>
5#include <boost/asio/awaitable.hpp>
6#include <boost/asio/ip/basic_endpoint.hpp>
7#include <boost/asio/use_awaitable.hpp>
12#include <spdlog/spdlog.h>
20 socket_ = std::make_unique<udp::socket>(io_context);
22 cancel_timer_.expires_at(std::chrono::system_clock::time_point::max());
28 [[maybe_unused]]
auto err_code =
co_await cancel_timer_.async_wait(asio::as_tuple(asio::use_awaitable));
30 spdlog::trace(
"Coroutine for the local socket with port {} is cancelled.",
port_number_);
asio::system_timer cancel_timer_
Used for cancel the unfinished coroutine.
auto cancel_coroutine() -> asio::awaitable< void >
auto wait_for_listen_finish(std::chrono::seconds time) -> std::optional< std::future_status >
std::unique_ptr< udp::socket > socket_
boost::system::error_code socket_ec_
SpecialSocket(int port_number, io_context_type &io_context)
std::shared_future< std::variant< std::monostate, std::monostate > > listen_future_
asio::thread_pool io_context_type