make post_torrent_updates more flexible by allowing to pass flags to it. The same flags as torrent_handle::status. Also make the default return accurante progress

This commit is contained in:
Arvid Norberg 2015-01-20 02:46:23 +00:00
parent d8d069675c
commit 54eb499803
4 changed files with 8 additions and 6 deletions

View File

@ -415,7 +415,7 @@ namespace libtorrent
, boost::uint32_t flags) const;
void refresh_torrent_status(std::vector<torrent_status>* ret
, boost::uint32_t flags) const;
void post_torrent_updates();
void post_torrent_updates(boost::uint32_t flags);
void post_session_stats();
void post_dht_stats();

View File

@ -355,7 +355,9 @@ namespace libtorrent
//
// Only torrents who has the state subscription flag set will be
// included. This flag is on by default. See add_torrent_params.
void post_torrent_updates();
// the ``flags`` argument is the same as for torrent_handle::status().
// see torrent_handle::status_flags_t.
void post_torrent_updates(boost::uint32_t flags = 0xffffffff);
// This function will post a session_stats_alert object, containing a
// snapshot of the performance counters from the internals of libtorrent.

View File

@ -568,9 +568,9 @@ namespace libtorrent
TORRENT_SYNC_CALL2(refresh_torrent_status, ret, flags);
}
void session::post_torrent_updates()
void session::post_torrent_updates(boost::uint32_t flags)
{
TORRENT_ASYNC_CALL(post_torrent_updates);
TORRENT_ASYNC_CALL1(post_torrent_updates, flags);
}
std::vector<stats_metric> session_stats_metrics()

View File

@ -4303,7 +4303,7 @@ retry:
}
}
void session_impl::post_torrent_updates()
void session_impl::post_torrent_updates(boost::uint32_t flags)
{
INVARIANT_CHECK;
@ -4333,7 +4333,7 @@ retry:
// the torrent to be loaded. Loading a torrent, and evicting another
// one will lead to calling state_updated(), which screws with
// this list while we're working on it, and break things
t->status(&alert->status.back(), ~torrent_handle::query_accurate_download_counters);
t->status(&alert->status.back(), flags);
t->clear_in_state_update();
}
state_updates.clear();