@@ -2976,7 +2976,7 @@ namespace {
29762976 };
29772977 }
29782978
2979- void torrent::announce_with_tracker (event_t e)
2979+ void torrent::announce_with_tracker (event_t e, bool const high_priority )
29802980 {
29812981 TORRENT_ASSERT (is_single_thread ());
29822982 TORRENT_ASSERT (e == event_t ::stopped || state () != torrent_status::checking_files);
@@ -3278,6 +3278,7 @@ namespace {
32783278 , print_endpoint (aep.local_endpoint ).c_str ());
32793279 }
32803280
3281+ if (high_priority) req.kind |= tracker_request::high_priority;
32813282 // if we're not logging session logs, don't bother creating an
32823283 // observer object just for logging
32833284 if (m_abort && m_ses.should_log ())
@@ -3842,7 +3843,15 @@ namespace {
38423843 debug_log (" *** found no tracker endpoints to announce" );
38433844 }
38443845#endif
3845- update_tracker_timer (aux::time_now32 ());
3846+
3847+ if (flags & torrent_handle::high_priority)
3848+ {
3849+ announce_with_tracker (event_t ::none, true );
3850+ }
3851+ else
3852+ {
3853+ update_tracker_timer (aux::time_now32 ());
3854+ }
38463855 }
38473856
38483857#if TORRENT_ABI_VERSION == 1
@@ -10129,7 +10138,8 @@ namespace {
1012910138
1013010139 update_want_tick ();
1013110140
10132- announce_with_tracker ();
10141+ bool const high_priority = m_connect_boost_counter > 0 ;
10142+ announce_with_tracker (event_t ::none, high_priority);
1013310143
1013410144 lsd_announce ();
1013510145 }
@@ -12350,7 +12360,8 @@ namespace {
1235012360 if ((!m_abort && !is_paused () && state () != torrent_status::checking_files)
1235112361 || r.event == event_t ::stopped)
1235212362 {
12353- announce_with_tracker (r.event );
12363+ // if the tracker that failed was high-priority, make the next attempt high priority as well
12364+ announce_with_tracker (r.event , (r.kind & torrent_handle::high_priority) != 0 );
1235412365 }
1235512366 else
1235612367 {
0 commit comments