add moving_storage field to torrent_status

This commit is contained in:
Arvid Norberg 2014-01-01 02:04:26 +00:00
parent 12ca5550d1
commit dc2243c17e
5 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,4 @@
* add moving_storage field to torrent_status
* expose UPnP and NAT-PMP mapping in session object * expose UPnP and NAT-PMP mapping in session object
* DHT refactoring and support for storing arbitrary data with put * DHT refactoring and support for storing arbitrary data with put
* support building on android * support building on android

View File

@ -1346,7 +1346,10 @@ namespace libtorrent
// more blocks to disk! // more blocks to disk!
bool m_deleted:1; bool m_deleted:1;
// TODO: there's space for another 2 bits here // set to true while moving the storage
bool m_moving_storage:1;
// TODO: there's space for another bit here
// ---- // ----

View File

@ -1431,6 +1431,11 @@ namespace libtorrent
// checked or as soon as one piece fails the hash check. // checked or as soon as one piece fails the hash check.
bool seed_mode; bool seed_mode;
// this is true if this torrent's storage is currently being moved from
// one location to another. This may potentially be a long operation
// if a large file ends up being copied from one drive to another.
bool moving_storage;
// the info-hash for this torrent // the info-hash for this torrent
sha1_hash info_hash; sha1_hash info_hash;
}; };

View File

@ -299,6 +299,7 @@ namespace libtorrent
, m_is_active_finished(false) , m_is_active_finished(false)
, m_ssl_torrent(false) , m_ssl_torrent(false)
, m_deleted(false) , m_deleted(false)
, m_moving_storage(false)
, m_incomplete(0xffffff) , m_incomplete(0xffffff)
, m_abort(false) , m_abort(false)
, m_announce_to_dht((p.flags & add_torrent_params::flag_paused) == 0) , m_announce_to_dht((p.flags & add_torrent_params::flag_paused) == 0)
@ -6506,6 +6507,7 @@ namespace libtorrent
#endif #endif
m_owning_storage->async_move_storage(path, flags m_owning_storage->async_move_storage(path, flags
, boost::bind(&torrent::on_storage_moved, shared_from_this(), _1, _2)); , boost::bind(&torrent::on_storage_moved, shared_from_this(), _1, _2));
m_moving_storage = true;
} }
else else
{ {
@ -6526,6 +6528,8 @@ namespace libtorrent
{ {
TORRENT_ASSERT(m_ses.is_network_thread()); TORRENT_ASSERT(m_ses.is_network_thread());
m_moving_storage = false;
if (ret == piece_manager::no_error || ret == piece_manager::need_full_check) if (ret == piece_manager::no_error || ret == piece_manager::need_full_check)
{ {
if (alerts().should_post<storage_moved_alert>()) if (alerts().should_post<storage_moved_alert>())
@ -8699,6 +8703,7 @@ namespace libtorrent
st->has_incoming = m_has_incoming; st->has_incoming = m_has_incoming;
if (m_error) st->error = convert_from_native(m_error.message()) + ": " + m_error_file; if (m_error) st->error = convert_from_native(m_error.message()) + ": " + m_error_file;
st->seed_mode = m_seed_mode; st->seed_mode = m_seed_mode;
st->moving_storage = m_moving_storage;
st->added_time = m_added_time; st->added_time = m_added_time;
st->completed_time = m_completed_time; st->completed_time = m_completed_time;

View File

@ -140,6 +140,7 @@ namespace libtorrent
, has_metadata(false) , has_metadata(false)
, has_incoming(false) , has_incoming(false)
, seed_mode(false) , seed_mode(false)
, moving_storage(false)
, info_hash(0) , info_hash(0)
{} {}