diff --git a/nano/boost/asio/ip/udp.hpp b/nano/boost/asio/ip/udp.hpp deleted file mode 100644 index 1efc97c57f..0000000000 --- a/nano/boost/asio/ip/udp.hpp +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#include - -DISABLE_ASIO_WARNINGS -#include -REENABLE_WARNINGS diff --git a/nano/lib/common.hpp b/nano/lib/common.hpp index 709eb6541d..bd1f309948 100644 --- a/nano/lib/common.hpp +++ b/nano/lib/common.hpp @@ -1,10 +1,9 @@ #pragma once #include -#include namespace nano { -using endpoint = boost::asio::ip::udp::endpoint; -using tcp_endpoint = boost::asio::ip::tcp::endpoint; +using endpoint = boost::asio::ip::tcp::endpoint; +using tcp_endpoint = endpoint; } \ No newline at end of file diff --git a/nano/node/common.hpp b/nano/node/common.hpp index 92bf001a0f..54c337ba1a 100644 --- a/nano/node/common.hpp +++ b/nano/node/common.hpp @@ -1,7 +1,6 @@ #pragma once #include -#include #include #include #include @@ -28,11 +27,6 @@ uint64_t endpoint_hash_raw (nano::endpoint const & endpoint_a) uint64_t result (nano::ip_address_hash_raw (endpoint_a.address (), endpoint_a.port ())); return result; } -uint64_t endpoint_hash_raw (nano::tcp_endpoint const & endpoint_a) -{ - uint64_t result (nano::ip_address_hash_raw (endpoint_a.address (), endpoint_a.port ())); - return result; -} template struct endpoint_hash @@ -46,10 +40,6 @@ struct endpoint_hash<8> { return endpoint_hash_raw (endpoint_a); } - std::size_t operator() (nano::tcp_endpoint const & endpoint_a) const - { - return endpoint_hash_raw (endpoint_a); - } }; template <> @@ -61,12 +51,6 @@ struct endpoint_hash<4> uint32_t result (static_cast (big) ^ static_cast (big >> 32)); return result; } - std::size_t operator() (nano::tcp_endpoint const & endpoint_a) const - { - uint64_t big (endpoint_hash_raw (endpoint_a)); - uint32_t result (static_cast (big) ^ static_cast (big >> 32)); - return result; - } }; template @@ -107,16 +91,6 @@ struct hash<::nano::endpoint> } }; -template <> -struct hash<::nano::tcp_endpoint> -{ - std::size_t operator() (::nano::tcp_endpoint const & endpoint_a) const - { - endpoint_hash ehash; - return ehash (endpoint_a); - } -}; - #ifndef BOOST_ASIO_HAS_STD_HASH template <> struct hash @@ -142,16 +116,6 @@ struct hash<::nano::endpoint> } }; -template <> -struct hash<::nano::tcp_endpoint> -{ - std::size_t operator() (::nano::tcp_endpoint const & endpoint_a) const - { - std::hash<::nano::tcp_endpoint> hash; - return hash (endpoint_a); - } -}; - template <> struct hash { diff --git a/nano/node/distributed_work.cpp b/nano/node/distributed_work.cpp index 3f2ffcb2d7..c963048baa 100644 --- a/nano/node/distributed_work.cpp +++ b/nano/node/distributed_work.cpp @@ -81,7 +81,7 @@ void nano::distributed_work::start () else { auto this_l (shared_from_this ()); - node.network.resolver.async_resolve (boost::asio::ip::udp::resolver::query (peer.first, std::to_string (peer.second)), [peer, this_l, &extra = resolved_extra] (boost::system::error_code const & ec, boost::asio::ip::udp::resolver::iterator i_a) { + node.network.resolver.async_resolve (boost::asio::ip::tcp::resolver::query (peer.first, std::to_string (peer.second)), [peer, this_l, &extra = resolved_extra] (boost::system::error_code const & ec, boost::asio::ip::tcp::resolver::iterator i_a) { if (!ec) { this_l->do_request (nano::tcp_endpoint (i_a->endpoint ().address (), i_a->endpoint ().port ())); diff --git a/nano/node/network.hpp b/nano/node/network.hpp index 86dcad5286..84c131e73d 100644 --- a/nano/node/network.hpp +++ b/nano/node/network.hpp @@ -121,7 +121,7 @@ class network final public: nano::networks const id; nano::syn_cookies syn_cookies; - boost::asio::ip::udp::resolver resolver; + boost::asio::ip::tcp::resolver resolver; nano::peer_exclusion excluded_peers; nano::network_filter publish_filter; nano::transport::tcp_channels tcp_channels; diff --git a/nano/node/node.cpp b/nano/node/node.cpp index bb521c160c..6cb3e8609b 100644 --- a/nano/node/node.cpp +++ b/nano/node/node.cpp @@ -74,10 +74,10 @@ nano::outbound_bandwidth_limiter::config nano::outbound_bandwidth_limiter_config void nano::node::keepalive (std::string const & address_a, uint16_t port_a) { auto node_l (shared_from_this ()); - network.resolver.async_resolve (boost::asio::ip::udp::resolver::query (address_a, std::to_string (port_a)), [node_l, address_a, port_a] (boost::system::error_code const & ec, boost::asio::ip::udp::resolver::iterator i_a) { + network.resolver.async_resolve (boost::asio::ip::tcp::resolver::query (address_a, std::to_string (port_a)), [node_l, address_a, port_a] (boost::system::error_code const & ec, boost::asio::ip::tcp::resolver::iterator i_a) { if (!ec) { - for (auto i (i_a), n (boost::asio::ip::udp::resolver::iterator{}); i != n; ++i) + for (auto i (i_a), n (boost::asio::ip::tcp::resolver::iterator{}); i != n; ++i) { auto endpoint (nano::transport::map_endpoint_to_v6 (i->endpoint ())); std::weak_ptr node_w (node_l);