diff --git a/docs/manual.rst b/docs/manual.rst index 2ac25c2dc..4a7cdb177 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -1589,6 +1589,7 @@ Its declaration looks like this:: boost::filesystem::path save_path() const; void move_storage(boost::filesystem::path const& save_path) const; + storage_interface* get_storage_impl() const; sha1_hash info_hash() const; @@ -1715,6 +1716,16 @@ the same drive as the original save path. Since disk IO is performed in a separa thread, this operation is also asynchronous. Once the operation completes, the ``storage_moved_alert`` is generated, with the new path as the message. +get_storage_impl() +------------------ + + :: + + storage_interface* get_storage_impl() const; + +Returns the storage implementation for this torrent. This depends on the +storage contructor function that was passed to ``session::add_torrent``. + force_reannounce() ------------------ diff --git a/include/libtorrent/storage.hpp b/include/libtorrent/storage.hpp index d2847cb8e..f144b5fc8 100644 --- a/include/libtorrent/storage.hpp +++ b/include/libtorrent/storage.hpp @@ -259,6 +259,8 @@ namespace libtorrent disk_check_aborted = -3 }; + storage_interface* get_storage_impl() { return m_storage.get(); } + private: fs::path save_path() const; diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index c812aed33..7c8a69020 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -170,6 +170,12 @@ namespace libtorrent int seed_rank(session_settings const& s) const; storage_mode_t storage_mode() const { return m_storage_mode; } + storage_interface* get_storage() + { + if (!m_owning_storage) return 0; + return m_owning_storage->get_storage_impl(); + } + // this will flag the torrent as aborted. The main // loop in session_impl will check for this state // on all torrents once every second, and take diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index 97d8edb37..87b3e984a 100644 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -366,6 +366,8 @@ namespace libtorrent bool resolve_countries() const; #endif + storage_interface* get_storage_impl() const; + // all these are deprecated, use piece // priority functions instead diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp index b02da4a6d..80e266bc3 100644 --- a/src/torrent_handle.cpp +++ b/src/torrent_handle.cpp @@ -499,6 +499,12 @@ namespace libtorrent TORRENT_FORWARD(replace_trackers(urls)); } + storage_interface* torrent_handle::get_storage_impl() const + { + INVARIANT_CHECK; + TORRENT_FORWARD_RETURN(get_storage(), 0); + } + torrent_info const& torrent_handle::get_torrent_info() const { INVARIANT_CHECK;