keep updating aux::time_now() while there are announces
This fixes an infinite loop when an announce during shutown fails and aux::time_now() has fallen behind clock_type::now() by more than the delay calculated in announce_entry::failed(). If this happens, announce_entry::can_announce() can forever return true when called from torrent::announce_with_tracker() because that function uses clock_type::now(). Also change torrent::announce_with_tracker() to use aux::time_now() just for consistency with the reset of the announce related functions.
This commit is contained in:
parent
4923effe23
commit
dc612b6423
|
@ -3052,10 +3052,13 @@ retry:
|
||||||
|
|
||||||
// we have to keep ticking the utp socket manager
|
// we have to keep ticking the utp socket manager
|
||||||
// until they're all closed
|
// until they're all closed
|
||||||
|
// we also have to keep updating the aux time while
|
||||||
|
// there are outstanding announces
|
||||||
if (m_abort)
|
if (m_abort)
|
||||||
{
|
{
|
||||||
if (m_utp_socket_manager.num_sockets() == 0
|
if (m_utp_socket_manager.num_sockets() == 0
|
||||||
&& m_undead_peers.empty())
|
&& m_undead_peers.empty()
|
||||||
|
&& m_tracker_manager.empty())
|
||||||
return;
|
return;
|
||||||
#if defined TORRENT_ASIO_DEBUGGING
|
#if defined TORRENT_ASIO_DEBUGGING
|
||||||
fprintf(stderr, "uTP sockets left: %d undead-peers left: %d\n"
|
fprintf(stderr, "uTP sockets left: %d undead-peers left: %d\n"
|
||||||
|
|
|
@ -3206,7 +3206,7 @@ namespace {
|
||||||
req.num_want = (req.event == tracker_request::stopped)
|
req.num_want = (req.event == tracker_request::stopped)
|
||||||
? 0 : settings().get_int(settings_pack::num_want);
|
? 0 : settings().get_int(settings_pack::num_want);
|
||||||
|
|
||||||
time_point now = clock_type::now();
|
time_point now = aux::time_now();
|
||||||
|
|
||||||
// the tier is kept as INT_MAX until we find the first
|
// the tier is kept as INT_MAX until we find the first
|
||||||
// tracker that works, then it's set to that tracker's
|
// tracker that works, then it's set to that tracker's
|
||||||
|
|
Loading…
Reference in New Issue