merged RC_1_1 into master

This commit is contained in:
Arvid Norberg 2018-07-08 18:52:13 +02:00
commit e317c72db3
4 changed files with 8 additions and 8 deletions

View File

@ -1808,7 +1808,7 @@ TORRENT_VERSION_NAMESPACE_2
// internal // internal
cache_flushed_alert(aux::stack_allocator& alloc, torrent_handle const& h); cache_flushed_alert(aux::stack_allocator& alloc, torrent_handle const& h);
TORRENT_DEFINE_ALERT(cache_flushed_alert, 58) TORRENT_DEFINE_ALERT_PRIO(cache_flushed_alert, 58, alert_priority_high)
static constexpr alert_category_t static_category = alert::storage_notification; static constexpr alert_category_t static_category = alert::storage_notification;
}; };

View File

@ -1174,7 +1174,7 @@ namespace libtorrent {
void on_file_renamed(std::string const& filename void on_file_renamed(std::string const& filename
, file_index_t file_idx , file_index_t file_idx
, storage_error const& error); , storage_error const& error);
void on_cache_flushed(); void on_cache_flushed(bool manually_triggered);
// this is used when a torrent is being removed.It synchronizes with the // this is used when a torrent is being removed.It synchronizes with the
// disk thread // disk thread

View File

@ -2242,7 +2242,7 @@ bool is_downloading_state(int const st)
// this will clear the stat cache, to make us actually query the // this will clear the stat cache, to make us actually query the
// filesystem for files again // filesystem for files again
m_ses.disk_thread().async_release_files(m_storage, []{}); m_ses.disk_thread().async_release_files(m_storage);
aux::vector<std::string, file_index_t> links; aux::vector<std::string, file_index_t> links;
m_ses.disk_thread().async_check_files(m_storage, nullptr m_ses.disk_thread().async_check_files(m_storage, nullptr
@ -7379,7 +7379,7 @@ bool is_downloading_state(int const st)
{ {
// we need to keep the object alive during this operation // we need to keep the object alive during this operation
m_ses.disk_thread().async_release_files(m_storage m_ses.disk_thread().async_release_files(m_storage
, std::bind(&torrent::on_cache_flushed, shared_from_this())); , std::bind(&torrent::on_cache_flushed, shared_from_this(), false));
} }
// this torrent just completed downloads, which means it will fall // this torrent just completed downloads, which means it will fall
@ -8463,16 +8463,16 @@ bool is_downloading_state(int const st)
return; return;
} }
m_ses.disk_thread().async_release_files(m_storage m_ses.disk_thread().async_release_files(m_storage
, std::bind(&torrent::on_cache_flushed, shared_from_this())); , std::bind(&torrent::on_cache_flushed, shared_from_this(), true));
} }
void torrent::on_cache_flushed() try void torrent::on_cache_flushed(bool const manually_triggered) try
{ {
TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(is_single_thread());
if (m_ses.is_aborted()) return; if (m_ses.is_aborted()) return;
if (alerts().should_post<cache_flushed_alert>()) if (manually_triggered || alerts().should_post<cache_flushed_alert>())
alerts().emplace_alert<cache_flushed_alert>(get_handle()); alerts().emplace_alert<cache_flushed_alert>(get_handle());
} }
catch (...) { handle_exception(); } catch (...) { handle_exception(); }

View File

@ -127,7 +127,7 @@ TORRENT_TEST(alerts_types)
TEST_ALERT_TYPE(dht_announce_alert, 55, 0, alert::dht_notification); TEST_ALERT_TYPE(dht_announce_alert, 55, 0, alert::dht_notification);
TEST_ALERT_TYPE(dht_get_peers_alert, 56, 0, alert::dht_notification); TEST_ALERT_TYPE(dht_get_peers_alert, 56, 0, alert::dht_notification);
TEST_ALERT_TYPE(stats_alert, 57, 0, alert::stats_notification); TEST_ALERT_TYPE(stats_alert, 57, 0, alert::stats_notification);
TEST_ALERT_TYPE(cache_flushed_alert, 58, 0, alert::storage_notification); TEST_ALERT_TYPE(cache_flushed_alert, 58, 1, alert::storage_notification);
#if TORRENT_ABI_VERSION == 1 #if TORRENT_ABI_VERSION == 1
TEST_ALERT_TYPE(anonymous_mode_alert, 59, 0, alert::error_notification); TEST_ALERT_TYPE(anonymous_mode_alert, 59, 0, alert::error_notification);
#else #else