From e870852c66f0d0110c10a6043082a82e6fcaaba0 Mon Sep 17 00:00:00 2001 From: arvidn Date: Fri, 12 May 2017 23:19:28 -0400 Subject: [PATCH] fix branch factor overflow in traversal algorithm --- src/kademlia/traversal_algorithm.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kademlia/traversal_algorithm.cpp b/src/kademlia/traversal_algorithm.cpp index 97137129e..de1b878fc 100644 --- a/src/kademlia/traversal_algorithm.cpp +++ b/src/kademlia/traversal_algorithm.cpp @@ -348,12 +348,12 @@ void traversal_algorithm::failed(observer_ptr o, int const flags) // we do get a late response, keep the handler // around for some more, but open up the slot // by increasing the branch factor - if ((o->flags & observer::flag_short_timeout) == 0) + if ((o->flags & observer::flag_short_timeout) == 0 + && m_branch_factor < std::numeric_limits::max()) { - TORRENT_ASSERT(m_branch_factor < (std::numeric_limits::max)()); ++m_branch_factor; + o->flags |= observer::flag_short_timeout; } - o->flags |= observer::flag_short_timeout; #ifndef TORRENT_DISABLE_LOGGING log_timeout(o, "1ST_"); #endif