From 80f5edc500bf10537427451d9b8fa72fe8ce43de Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Wed, 28 Feb 2018 09:07:56 -0500 Subject: [PATCH] added some static and const in node.cpp and minor cleanup in rpc_manager.cpp --- src/kademlia/node.cpp | 6 +++--- src/kademlia/rpc_manager.cpp | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/kademlia/node.cpp b/src/kademlia/node.cpp index 41003e3c6..144e46e55 100644 --- a/src/kademlia/node.cpp +++ b/src/kademlia/node.cpp @@ -821,7 +821,7 @@ void node::incoming_request(msg const& m, entry& e) // mirror back the other node's external port reply["p"] = m.addr.port(); - string_view query = top_level[0].string_value(); + string_view const query = top_level[0].string_value(); if (m_observer && m_observer->on_dht_request(query, m, e)) return; @@ -1094,7 +1094,7 @@ void node::incoming_request(msg const& m, entry& e) } else if (query == "get") { - key_desc_t msg_desc[] = { + static key_desc_t const msg_desc[] = { {"seq", bdecode_node::int_t, 0, key_desc_t::optional}, {"target", bdecode_node::string_t, 20, 0}, {"want", bdecode_node::list_t, 0, key_desc_t::optional}, @@ -1220,7 +1220,7 @@ void node::write_nodes_entries(sha1_hash const& info_hash node::protocol_descriptor const& node::map_protocol_to_descriptor(udp protocol) { - static std::array descriptors = + static std::array const descriptors = {{ {udp::v4(), "n4", "nodes"}, {udp::v6(), "n6", "nodes6"} diff --git a/src/kademlia/rpc_manager.cpp b/src/kademlia/rpc_manager.cpp index 21a44ca0b..a3544919f 100644 --- a/src/kademlia/rpc_manager.cpp +++ b/src/kademlia/rpc_manager.cpp @@ -47,7 +47,6 @@ POSSIBILITY OF SUCH DAMAGE. #include #include // for print_endpoint -#include #include // for aux::time_now #include @@ -241,7 +240,7 @@ void rpc_manager::unreachable(udp::endpoint const& ep) observer_ptr o = i->second; #ifndef TORRENT_DISABLE_LOGGING m_log->log(dht_logger::rpc_manager, "[%u] found transaction [ tid: %d ]" - , o->algorithm()->id(), int(i->first)); + , o->algorithm()->id(), i->first); #endif i = m_transactions.erase(i); o->timeout();