From 135e47c9298b0656bf445e389efc6b124f631a70 Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Sun, 4 Mar 2018 13:28:31 -0500 Subject: [PATCH] minimal optimization by using node_id::is_all_zero --- src/kademlia/node.cpp | 2 +- src/kademlia/put_data.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kademlia/node.cpp b/src/kademlia/node.cpp index 144e46e55..7cd4c2c7b 100644 --- a/src/kademlia/node.cpp +++ b/src/kademlia/node.cpp @@ -85,7 +85,7 @@ node_id calculate_node_id(node_id const& nid, aux::listen_socket_handle const& s return generate_random_id(); } - if (nid == node_id::min() || !verify_id(nid, external_address)) + if (nid.is_all_zeros() || !verify_id(nid, external_address)) return generate_id(external_address); return nid; diff --git a/src/kademlia/put_data.cpp b/src/kademlia/put_data.cpp index 0ed8c8535..0798c527d 100644 --- a/src/kademlia/put_data.cpp +++ b/src/kademlia/put_data.cpp @@ -39,7 +39,7 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { namespace dht { put_data::put_data(node& dht_node, put_callback const& callback) - : traversal_algorithm(dht_node, (node_id::min)()) + : traversal_algorithm(dht_node, {}) , m_put_callback(callback) {}