fix branch factor overflow in traversal algorithm

This commit is contained in:
arvidn 2017-05-12 23:19:28 -04:00 committed by Arvid Norberg
parent e0fa1cd247
commit e870852c66
1 changed files with 3 additions and 3 deletions

View File

@ -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<std::int8_t>::max())
{
TORRENT_ASSERT(m_branch_factor < (std::numeric_limits<std::int8_t>::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