made test_web_seed build and fixed test_metadata_extension
This commit is contained in:
parent
7a30b397f8
commit
b1bc1a9de0
|
@ -14,7 +14,7 @@ void test_transfer(bool clear_files = true, bool disconnect = false)
|
|||
{
|
||||
using namespace libtorrent;
|
||||
|
||||
session ses1;
|
||||
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48000, 49000));
|
||||
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49000, 50000));
|
||||
ses1.add_extension(&create_metadata_plugin);
|
||||
ses2.add_extension(&create_metadata_plugin);
|
||||
|
|
|
@ -42,13 +42,14 @@ void test_transfer()
|
|||
add_files(torrent_file, full_path.branch_path(), full_path.leaf());
|
||||
|
||||
file_pool fp;
|
||||
storage st(torrent_file, full_path.branch_path(), fp);
|
||||
boost::scoped_ptr<storage_interface> s(default_storage_constructor(
|
||||
torrent_file, full_path.branch_path(), fp));
|
||||
// calculate the hash for all pieces
|
||||
int num = torrent_file.num_pieces();
|
||||
std::vector<char> buf(torrent_file.piece_length());
|
||||
for (int i = 0; i < num; ++i)
|
||||
{
|
||||
st.read(&buf[0], i, 0, torrent_file.piece_size(i));
|
||||
s->read(&buf[0], i, 0, torrent_file.piece_size(i));
|
||||
hasher h(&buf[0], torrent_file.piece_size(i));
|
||||
torrent_file.set_hash(i, h.final());
|
||||
}
|
||||
|
@ -57,6 +58,7 @@ void test_transfer()
|
|||
torrent_file.create_torrent();
|
||||
|
||||
session ses;
|
||||
ses.listen_on(std::make_pair(49000, 50000));
|
||||
remove_all("./tmp1");
|
||||
torrent_handle th = ses.add_torrent(torrent_file, "./tmp1");
|
||||
|
||||
|
|
Loading…
Reference in New Issue