forked from premiere/premiere-libtorrent
extend the metadata unit test to make sure the metadata is forwarded to a 3rd peer
This commit is contained in:
parent
90719bf77d
commit
c8434f56eb
|
@ -50,19 +50,23 @@ void test_transfer(bool clear_files, bool disconnect
|
|||
|
||||
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48100, 49000), "0.0.0.0", 0);
|
||||
session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49100, 50000), "0.0.0.0", 0);
|
||||
session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50100, 51000), "0.0.0.0", 0);
|
||||
ses1.add_extension(constructor);
|
||||
ses2.add_extension(constructor);
|
||||
ses3.add_extension(constructor);
|
||||
torrent_handle tor1;
|
||||
torrent_handle tor2;
|
||||
torrent_handle tor3;
|
||||
#ifndef TORRENT_DISABLE_ENCRYPTION
|
||||
pe_settings pes;
|
||||
pes.out_enc_policy = pe_settings::forced;
|
||||
pes.in_enc_policy = pe_settings::forced;
|
||||
ses1.set_pe_settings(pes);
|
||||
ses2.set_pe_settings(pes);
|
||||
ses3.set_pe_settings(pes);
|
||||
#endif
|
||||
|
||||
boost::tie(tor1, tor2, ignore) = setup_transfer(&ses1, &ses2, 0, clear_files, true, true, "_meta");
|
||||
boost::tie(tor1, tor2, tor3) = setup_transfer(&ses1, &ses2, &ses3, clear_files, true, true, "_meta");
|
||||
|
||||
for (int i = 0; i < 80; ++i)
|
||||
{
|
||||
|
@ -73,13 +77,16 @@ void test_transfer(bool clear_files, bool disconnect
|
|||
print_alerts(ses2, "ses2", false, true);
|
||||
|
||||
if (disconnect && tor2.is_valid()) ses2.remove_torrent(tor2);
|
||||
if (!disconnect && tor2.status().has_metadata) break;
|
||||
if (!disconnect
|
||||
&& tor2.status().has_metadata
|
||||
&& tor3.status().has_metadata) break;
|
||||
test_sleep(100);
|
||||
}
|
||||
|
||||
if (disconnect) return;
|
||||
|
||||
TEST_CHECK(tor2.status().has_metadata);
|
||||
TEST_CHECK(tor3.status().has_metadata);
|
||||
std::cerr << "waiting for transfer to complete\n";
|
||||
|
||||
for (int i = 0; i < 30; ++i)
|
||||
|
|
Loading…
Reference in New Issue