optimized memory usage of torrent_info and file_storage
This commit is contained in:
@@ -804,7 +804,7 @@ void run_test(std::string const& test_path, bool unbuffered)
|
||||
file_storage fs;
|
||||
fs.add_file("temp_storage/test1.tmp", 3 * piece_size);
|
||||
libtorrent::create_torrent t(fs, piece_size, -1, 0);
|
||||
TEST_CHECK(fs.begin()->path == "temp_storage/test1.tmp");
|
||||
TEST_CHECK(fs.file_path(*fs.begin()) == "temp_storage/test1.tmp");
|
||||
t.set_hash(0, hasher(piece0, piece_size).final());
|
||||
t.set_hash(1, hasher(piece1, piece_size).final());
|
||||
t.set_hash(2, hasher(piece2, piece_size).final());
|
||||
|
@@ -151,7 +151,8 @@ void test_transfer(boost::intrusive_ptr<torrent_info> torrent_file
|
||||
|
||||
if (proxy) stop_proxy(8002);
|
||||
|
||||
TEST_CHECK(exists(combine_path("./tmp2_web_seed", torrent_file->file_at(0).path)));
|
||||
TEST_CHECK(exists(combine_path("./tmp2_web_seed", torrent_file->files().file_path(
|
||||
torrent_file->file_at(0)))));
|
||||
remove_all("./tmp2_web_seed", ec);
|
||||
}
|
||||
|
||||
@@ -256,10 +257,11 @@ int run_suite(char const* protocol, bool test_url_seed, bool chunked_encoding)
|
||||
// verify that the file hashes are correct
|
||||
for (int i = 0; i < torrent_file->num_files(); ++i)
|
||||
{
|
||||
TEST_CHECK(torrent_file->file_at(i).filehash_index >= 0);
|
||||
sha1_hash h1 = torrent_file->files().hash(torrent_file->file_at(i).filehash_index);
|
||||
sha1_hash h2 = file_hash(combine_path("./tmp1_web_seed", torrent_file->file_at(i).path));
|
||||
fprintf(stderr, "%s: %s == %s\n", torrent_file->file_at(i).path.c_str()
|
||||
sha1_hash h1 = torrent_file->files().hash(torrent_file->file_at(i));
|
||||
sha1_hash h2 = file_hash(combine_path("./tmp1_web_seed"
|
||||
, torrent_file->files().file_path(torrent_file->file_at(i))));
|
||||
fprintf(stderr, "%s: %s == %s\n"
|
||||
, torrent_file->files().file_path(torrent_file->file_at(i)).c_str()
|
||||
, to_hex(h1.to_string()).c_str(), to_hex(h2.to_string()).c_str());
|
||||
TEST_EQUAL(h1, h2);
|
||||
}
|
||||
|
Reference in New Issue
Block a user