From 9d83da110b10ef758051abdbafaf600318d535db Mon Sep 17 00:00:00 2001 From: Fernando Rodriguez Date: Fri, 6 Apr 2018 11:25:13 -0400 Subject: [PATCH] Delay hash_failed_alert until on_piece_sync() Delay the hash_failed_alert until after synchronizing with the IO thread so that it can be used to synchronize piece progress. --- src/torrent.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/torrent.cpp b/src/torrent.cpp index d3fc722e5..765fa779c 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -4525,9 +4525,6 @@ namespace { inc_stats_counter(counters::num_piece_failed); - if (m_ses.alerts().should_post()) - m_ses.alerts().emplace_alert(get_handle(), index); - std::vector::iterator it = std::lower_bound(m_predictive_pieces.begin() , m_predictive_pieces.end(), index); if (it != m_predictive_pieces.end() && *it == index) @@ -4728,6 +4725,9 @@ namespace { // ever downloaded for it. m_picker->restore_piece(j->piece); + if (m_ses.alerts().should_post()) + m_ses.alerts().emplace_alert(get_handle(), j->piece); + // we have to let the piece_picker know that // this piece failed the check as it can restore it // and mark it as being interesting for download