diff --git a/src/torrent.cpp b/src/torrent.cpp index f24789688..eea6c17ca 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -5770,7 +5770,7 @@ namespace libtorrent state_updated(); return true; } - + bool torrent::unchoke_peer(peer_connection& c, bool optimistic) { INVARIANT_CHECK; @@ -8297,7 +8297,7 @@ namespace libtorrent m_ses.alerts().emplace_alert( get_handle()); } - + // calling pause will also trigger the auto managed // recalculation // if we just got here by downloading the metadata, @@ -9429,7 +9429,7 @@ namespace libtorrent m_web_seeds.push_back(ent); m_need_save_resume_data = true; } - + void torrent::set_allow_peers(bool b, bool graceful) { TORRENT_ASSERT(is_single_thread()); diff --git a/test/Jamfile b/test/Jamfile index 5e89859b4..5141929f4 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -143,8 +143,6 @@ test-suite libtorrent : test_fence.cpp test_dos_blocker.cpp ] - [ run test_upnp.cpp ] - [ run test_storage.cpp ] [ run test_session.cpp ] [ run test_read_piece.cpp ] @@ -179,10 +177,11 @@ test-suite libtorrent : [ run test_metadata_extension.cpp ] [ run test_trackers_extension.cpp ] [ run test_time_critical.cpp ] - [ run test_lsd.cpp ] [ run test_pex.cpp ] # make these test more reliable +# [ run test_upnp.cpp ] +# [ run test_lsd.cpp ] # [ run test_priority.cpp ] # [ run test_swarm.cpp ] # [ run test_super_seeding.cpp ] diff --git a/test/setup_transfer.cpp b/test/setup_transfer.cpp index 54777d62c..84151ea1a 100644 --- a/test/setup_transfer.cpp +++ b/test/setup_transfer.cpp @@ -627,7 +627,7 @@ boost::shared_ptr create_torrent(std::ostream* file, int piece_siz std::vector piece(piece_size); for (int i = 0; i < int(piece.size()); ++i) piece[i] = (i % 26) + 'A'; - + // calculate the hash for all pieces int num = t.num_pieces(); sha1_hash ph = hasher(&piece[0], piece.size()).final(); @@ -642,7 +642,7 @@ boost::shared_ptr create_torrent(std::ostream* file, int piece_siz total_size -= piece.size(); } } - + std::vector tmp; std::back_insert_iterator > out(tmp); @@ -770,7 +770,7 @@ setup_transfer(lt::session* ses1, lt::session* ses2, lt::session* ses3 TEST_CHECK(!ses3->get_torrents().empty()); } - if (use_metadata_transfer) + if (use_metadata_transfer) { param.ti.reset(); param.info_hash = t->info_hash(); diff --git a/test/setup_transfer.hpp b/test/setup_transfer.hpp index a98669856..e8005091f 100644 --- a/test/setup_transfer.hpp +++ b/test/setup_transfer.hpp @@ -78,7 +78,7 @@ EXPORT bool print_alerts(libtorrent::session& ses, char const* name EXPORT void wait_for_listen(libtorrent::session& ses, char const* name); EXPORT void wait_for_downloading(libtorrent::session& ses, char const* name); EXPORT void test_sleep(int millisec); - + EXPORT void create_random_files(std::string const& path, const int file_sizes[], int num_files); EXPORT boost::shared_ptr create_torrent(std::ostream* file = 0 diff --git a/test/swarm_suite.cpp b/test/swarm_suite.cpp index cec1a16c5..5a85753b3 100644 --- a/test/swarm_suite.cpp +++ b/test/swarm_suite.cpp @@ -123,6 +123,8 @@ void test_swarm(int flags) torrent_handle tor3; add_torrent_params p; + p.flags &= ~add_torrent_params::flag_paused; + p.flags &= ~add_torrent_params::flag_auto_managed; if (flags & seed_mode) p.flags |= add_torrent_params::flag_seed_mode; // test using piece sizes smaller than 16kB boost::tie(tor1, tor2, tor3) = setup_transfer(&ses1, &ses2, &ses3, true diff --git a/test/test_magnet.cpp b/test/test_magnet.cpp index a0657f1de..447313228 100644 --- a/test/test_magnet.cpp +++ b/test/test_magnet.cpp @@ -43,6 +43,8 @@ void test_remove_url(std::string url) { lt::session s; add_torrent_params p; + p.flags &= ~add_torrent_params::flag_paused; + p.flags &= ~add_torrent_params::flag_auto_managed; p.url = url; p.save_path = "."; torrent_handle h = s.add_torrent(p); @@ -94,6 +96,8 @@ TORRENT_TEST(magnet) // test magnet link parsing add_torrent_params p; + p.flags &= ~add_torrent_params::flag_paused; + p.flags &= ~add_torrent_params::flag_auto_managed; p.save_path = "."; error_code ec; p.url = "magnet:?xt=urn:btih:cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd" diff --git a/test/test_read_piece.cpp b/test/test_read_piece.cpp index a1cb80f39..87ad97ece 100644 --- a/test/test_read_piece.cpp +++ b/test/test_read_piece.cpp @@ -93,6 +93,8 @@ void test_read_piece(int flags) lt::session ses(sett); add_torrent_params p; + p.flags &= ~add_torrent_params::flag_paused; + p.flags &= ~add_torrent_params::flag_auto_managed; p.save_path = "tmp1_read_piece"; p.ti = ti; if (flags & seed_mode) diff --git a/test/test_remap_files.cpp b/test/test_remap_files.cpp index 0e5e323e6..6e79727d4 100644 --- a/test/test_remap_files.cpp +++ b/test/test_remap_files.cpp @@ -72,6 +72,10 @@ void test_remap_files_gather(storage_mode_t storage_mode = storage_mode_sparse) session_proxy p2; settings_pack sett; + sett.set_bool(settings_pack::enable_upnp, false); + sett.set_bool(settings_pack::enable_natpmp, false); + sett.set_bool(settings_pack::enable_lsd, false); + sett.set_bool(settings_pack::enable_dht, false); sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075"); sett.set_int(settings_pack::alert_mask, alert_mask); @@ -229,6 +233,10 @@ void test_remap_files_scatter(storage_mode_t storage_mode = storage_mode_sparse) session_proxy p2; settings_pack sett; + sett.set_bool(settings_pack::enable_upnp, false); + sett.set_bool(settings_pack::enable_natpmp, false); + sett.set_bool(settings_pack::enable_lsd, false); + sett.set_bool(settings_pack::enable_dht, false); sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075"); sett.set_int(settings_pack::alert_mask, alert_mask); @@ -367,6 +375,10 @@ void test_remap_files_prio(storage_mode_t storage_mode = storage_mode_sparse) session_proxy p2; settings_pack sett; + sett.set_bool(settings_pack::enable_upnp, false); + sett.set_bool(settings_pack::enable_natpmp, false); + sett.set_bool(settings_pack::enable_lsd, false); + sett.set_bool(settings_pack::enable_dht, false); sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075"); sett.set_int(settings_pack::alert_mask, alert_mask); lt::session ses1(sett); diff --git a/test/test_storage.cpp b/test/test_storage.cpp index 2b1db5f07..32d8ba116 100644 --- a/test/test_storage.cpp +++ b/test/test_storage.cpp @@ -635,7 +635,7 @@ void test_fastresume(std::string const& test_path) TEST_CHECK(exists(combine_path(p.save_path, "temporary"))); if (!exists(combine_path(p.save_path, "temporary"))) return; - + torrent_status s; for (int i = 0; i < 50; ++i) { @@ -678,12 +678,14 @@ void test_fastresume(std::string const& test_path) lt::session ses(pack); add_torrent_params p; + p.flags &= ~add_torrent_params::flag_paused; + p.flags &= ~add_torrent_params::flag_auto_managed; p.ti = boost::make_shared(boost::cref(*t)); p.save_path = combine_path(test_path, "tmp1"); p.storage_mode = storage_mode_compact; bencode(std::back_inserter(p.resume_data), resume); torrent_handle h = ses.add_torrent(p, ec); - + alert const* a = wait_for_alert(ses, fastresume_rejected_alert::alert_type , "ses"); // we expect the fast resume to be rejected because the files were removed diff --git a/test/test_torrent.cpp b/test/test_torrent.cpp index b2877885c..6c656a073 100644 --- a/test/test_torrent.cpp +++ b/test/test_torrent.cpp @@ -59,6 +59,8 @@ void test_running_torrent(boost::shared_ptr info, boost::int64_t f std::vector zeroes; zeroes.resize(1000, 0); add_torrent_params p; + p.flags &= ~add_torrent_params::flag_paused; + p.flags &= ~add_torrent_params::flag_auto_managed; p.ti = info; p.save_path = "."; diff --git a/test/test_trackers_extension.cpp b/test/test_trackers_extension.cpp index 9974e92b1..dd632cd99 100644 --- a/test/test_trackers_extension.cpp +++ b/test/test_trackers_extension.cpp @@ -63,6 +63,8 @@ TORRENT_TEST(trackers_extension) ses2.add_extension(create_lt_trackers_plugin); add_torrent_params atp; + atp.flags &= ~add_torrent_params::flag_paused; + atp.flags &= ~add_torrent_params::flag_auto_managed; atp.info_hash = sha1_hash("12345678901234567890"); atp.save_path = "./"; error_code ec; diff --git a/test/test_transfer.cpp b/test/test_transfer.cpp index 67088502d..3d15dd1c8 100644 --- a/test/test_transfer.cpp +++ b/test/test_transfer.cpp @@ -245,6 +245,8 @@ void test_transfer(int proxy_type, settings_pack const& sett add_torrent_params params; params.storage_mode = storage_mode; + params.flags &= ~add_torrent_params::flag_paused; + params.flags &= ~add_torrent_params::flag_auto_managed; wait_for_listen(ses1, "ses1"); wait_for_listen(ses2, "ses2"); diff --git a/test/test_utp.cpp b/test/test_utp.cpp index c516a65d6..23e416c08 100644 --- a/test/test_utp.cpp +++ b/test/test_utp.cpp @@ -89,6 +89,8 @@ void test_transfer() // for performance testing add_torrent_params atp; + atp.flags &= ~add_torrent_params::flag_paused; + atp.flags &= ~add_torrent_params::flag_auto_managed; // atp.storage = &disabled_storage_constructor; // test using piece sizes smaller than 16kB