From 333a13c95739878ef685fb14fd129fc6b1fcbb31 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 10 Dec 2014 07:13:57 +0000 Subject: [PATCH] a bit more conservative block request timeouts. promote some invariant checks in the DHT as expensive (to disable them for regular debug builds) --- src/kademlia/routing_table.cpp | 4 ++++ src/peer_connection.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/kademlia/routing_table.cpp b/src/kademlia/routing_table.cpp index d3d9ea307..f5ceb830b 100644 --- a/src/kademlia/routing_table.cpp +++ b/src/kademlia/routing_table.cpp @@ -490,7 +490,9 @@ bool routing_table::add_node(node_entry e) routing_table::add_node_status_t routing_table::add_node_impl(node_entry e) { +#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS INVARIANT_CHECK; +#endif // if we already have this (IP,port), don't do anything if (m_router_nodes.find(e.ep()) != m_router_nodes.end()) @@ -940,7 +942,9 @@ void routing_table::for_each_node( void routing_table::node_failed(node_id const& nid, udp::endpoint const& ep) { +#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS INVARIANT_CHECK; +#endif // if messages to ourself fails, ignore it if (nid == m_id) return; diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index bfa401769..7085a68e9 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -4193,7 +4193,7 @@ namespace libtorrent } else { - ret = avg + deviation * 3; + ret = avg + deviation * 4; } // ret is milliseconds, the return value is seconds. Convert to