forked from premiere/premiere-libtorrent
move_storage did not work for torrents without metadata
This commit is contained in:
parent
a48cdd0281
commit
a97121d6f2
|
@ -1,3 +1,4 @@
|
|||
* move_storage did not work for torrents without metadata
|
||||
* improve shutdown time by only announcing to trackers whose IP we know
|
||||
* fix python3 portability issue in python binding
|
||||
* delay 5 seconds before reconnecting socks5 proxy for UDP ASSOCIATE
|
||||
|
|
|
@ -8931,12 +8931,17 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
// if we don't have metadata yet, we don't know anything about the file
|
||||
// structure and we have to assume we don't have any file. Deleting files
|
||||
// in this mode would cause us to (recursively) delete m_save_path, which
|
||||
// is bad.
|
||||
// structure and we have to assume we don't have any file.
|
||||
if (!valid_metadata())
|
||||
{
|
||||
alerts().emplace_alert<torrent_deleted_alert>(get_handle(), m_torrent_file->info_hash());
|
||||
if (alerts().should_post<storage_moved_alert>())
|
||||
alerts().emplace_alert<storage_moved_alert>(get_handle(), save_path);
|
||||
#if TORRENT_USE_UNC_PATHS
|
||||
std::string path = canonicalize_path(save_path);
|
||||
#else
|
||||
std::string const& path = save_path;
|
||||
#endif
|
||||
m_save_path = complete(path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/torrent.hpp"
|
||||
#include "libtorrent/peer_info.hpp"
|
||||
#include "libtorrent/extensions.hpp"
|
||||
#include "libtorrent/magnet_uri.hpp"
|
||||
#include "settings.hpp"
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
@ -502,3 +503,19 @@ TORRENT_TEST(queue)
|
|||
TEST_EQUAL(torrents[3].queue_position(), 4);
|
||||
}
|
||||
|
||||
TORRENT_TEST(test_move_storage_no_metadata)
|
||||
{
|
||||
lt::session ses(settings());
|
||||
add_torrent_params p;
|
||||
p.save_path = "save_path";
|
||||
error_code ec;
|
||||
parse_magnet_uri("magnet?xt=urn:btih:abababababababababababababababababababab", p, ec);
|
||||
torrent_handle h = ses.add_torrent(p);
|
||||
|
||||
TEST_EQUAL(h.status().save_path, complete("save_path"));
|
||||
|
||||
h.move_storage("save_path_1");
|
||||
|
||||
TEST_EQUAL(h.status().save_path, complete("save_path_1"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue