diff --git a/nano/node/transport/tcp_listener.cpp b/nano/node/transport/tcp_listener.cpp index a4358ac51a..927b16426b 100644 --- a/nano/node/transport/tcp_listener.cpp +++ b/nano/node/transport/tcp_listener.cpp @@ -22,7 +22,7 @@ nano::transport::tcp_listener::tcp_listener (uint16_t port_a, nano::node & node_ port{ port_a }, max_inbound_connections{ max_inbound_connections }, acceptor{ node_a.io_ctx }, - local{ boost::asio::ip::tcp::endpoint{ boost::asio::ip::address_v6::any (), port_a } } + local{ asio::ip::tcp::endpoint{ asio::ip::address_v6::any (), port_a } } { connection_accepted.add ([this] (auto const & socket, auto const & server) { node.observers.socket_accepted.notify (*socket); @@ -43,9 +43,9 @@ void nano::transport::tcp_listener::start (std::function future; + std::future future; { nano::unique_lock lock{ mutex }; - future = acceptor.async_accept (boost::asio::use_future); + future = acceptor.async_accept (asio::use_future); } future.wait (); return future.get (); @@ -225,7 +225,7 @@ auto nano::transport::tcp_listener::accept_one () -> accept_result try { // Best effor attempt to gracefully close the socket, shutdown before closing to avoid zombie sockets - raw_socket.shutdown (boost::asio::ip::tcp::socket::shutdown_both); + raw_socket.shutdown (asio::ip::tcp::socket::shutdown_both); raw_socket.close (); } catch (boost::system::system_error const & ex) @@ -272,7 +272,7 @@ void nano::transport::tcp_listener::wait_available_slots () } } -auto nano::transport::tcp_listener::check_limits (boost::asio::ip::address const & ip) -> accept_result +auto nano::transport::tcp_listener::check_limits (asio::ip::address const & ip) -> accept_result { nano::lock_guard lock{ mutex }; @@ -348,7 +348,7 @@ size_t nano::transport::tcp_listener::bootstrap_count () const }); } -size_t nano::transport::tcp_listener::count_per_ip (boost::asio::ip::address const & ip) const +size_t nano::transport::tcp_listener::count_per_ip (asio::ip::address const & ip) const { debug_assert (!mutex.try_lock ()); @@ -357,7 +357,7 @@ size_t nano::transport::tcp_listener::count_per_ip (boost::asio::ip::address con }); } -size_t nano::transport::tcp_listener::count_per_subnetwork (boost::asio::ip::address const & ip) const +size_t nano::transport::tcp_listener::count_per_subnetwork (asio::ip::address const & ip) const { debug_assert (!mutex.try_lock ()); @@ -366,15 +366,15 @@ size_t nano::transport::tcp_listener::count_per_subnetwork (boost::asio::ip::add }); } -boost::asio::ip::tcp::endpoint nano::transport::tcp_listener::endpoint () const +asio::ip::tcp::endpoint nano::transport::tcp_listener::endpoint () const { if (!stopped) { - return { boost::asio::ip::address_v6::loopback (), acceptor.local_endpoint ().port () }; + return { asio::ip::address_v6::loopback (), acceptor.local_endpoint ().port () }; } else { - return { boost::asio::ip::address_v6::loopback (), 0 }; + return { asio::ip::address_v6::loopback (), 0 }; } } diff --git a/nano/node/transport/tcp_listener.hpp b/nano/node/transport/tcp_listener.hpp index 4111992842..abcf2bb207 100644 --- a/nano/node/transport/tcp_listener.hpp +++ b/nano/node/transport/tcp_listener.hpp @@ -11,6 +11,7 @@ #include namespace mi = boost::multi_index; +namespace asio = boost::asio; namespace nano { @@ -68,20 +69,20 @@ class tcp_listener final }; accept_result accept_one (); - accept_result check_limits (boost::asio::ip::address const & ip); - boost::asio::ip::tcp::socket accept_socket (); + accept_result check_limits (asio::ip::address const & ip); + asio::ip::tcp::socket accept_socket (); - size_t count_per_ip (boost::asio::ip::address const & ip) const; - size_t count_per_subnetwork (boost::asio::ip::address const & ip) const; + size_t count_per_ip (asio::ip::address const & ip) const; + size_t count_per_subnetwork (asio::ip::address const & ip) const; private: struct entry { - boost::asio::ip::tcp::endpoint endpoint; + asio::ip::tcp::endpoint endpoint; std::weak_ptr socket; std::weak_ptr server; - boost::asio::ip::address address () const + asio::ip::address address () const { return endpoint.address (); } @@ -97,13 +98,13 @@ class tcp_listener final using ordered_connections = boost::multi_index_container, - mi::const_mem_fun> + mi::const_mem_fun> >>; // clang-format on ordered_connections connections; - boost::asio::ip::tcp::acceptor acceptor; - boost::asio::ip::tcp::endpoint local; + asio::ip::tcp::acceptor acceptor; + asio::ip::tcp::endpoint local; std::atomic stopped; nano::condition_variable condition;