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.
This commit is contained in:
Fernando Rodriguez 2018-04-06 11:25:13 -04:00 committed by Arvid Norberg
parent 357217326d
commit 9d83da110b
1 changed files with 3 additions and 3 deletions

View File

@ -4525,9 +4525,6 @@ namespace {
inc_stats_counter(counters::num_piece_failed);
if (m_ses.alerts().should_post<hash_failed_alert>())
m_ses.alerts().emplace_alert<hash_failed_alert>(get_handle(), index);
std::vector<int>::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<hash_failed_alert>())
m_ses.alerts().emplace_alert<hash_failed_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