From 16bfde875d582e73062ec514d4ba8a24a7c0b3b9 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 20 Dec 2008 23:06:06 +0000 Subject: [PATCH] tests don't need the default session features turned on --- src/session_impl.cpp | 1 + test/test_auto_unchoke.cpp | 6 +++--- test/test_fast_extension.cpp | 4 ++-- test/test_lsd.cpp | 6 +++--- test/test_pe_crypto.cpp | 4 ++-- test/test_pex.cpp | 6 +++--- test/test_storage.cpp | 8 ++++---- test/test_swarm.cpp | 6 +++--- test/test_torrent.cpp | 2 +- test/test_transfer.cpp | 8 ++++---- test/test_web_seed.cpp | 2 +- 11 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 4b471c0c6..48d0d6c73 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -188,6 +188,7 @@ namespace aux { , m_total_failed_bytes(0) , m_total_redundant_bytes(0) { + TORRENT_ASSERT(listen_interface); error_code ec; m_listen_interface = tcp::endpoint(address::from_string(listen_interface, ec), listen_port_range.first); TORRENT_ASSERT(!ec); diff --git a/test/test_auto_unchoke.cpp b/test/test_auto_unchoke.cpp index 3079558e6..68e42a860 100644 --- a/test/test_auto_unchoke.cpp +++ b/test/test_auto_unchoke.cpp @@ -16,9 +16,9 @@ void test_swarm() { using namespace libtorrent; - session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48010, 49000)); - session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49010, 50000)); - session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50010, 51000)); + session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48010, 49000), "0.0.0.0", 0); + session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49010, 50000), "0.0.0.0", 0); + session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50010, 51000), "0.0.0.0", 0); ses1.set_severity_level(alert::debug); ses2.set_severity_level(alert::debug); diff --git a/test/test_fast_extension.cpp b/test/test_fast_extension.cpp index 6940949f2..caa18805d 100644 --- a/test/test_fast_extension.cpp +++ b/test/test_fast_extension.cpp @@ -161,7 +161,7 @@ void test_reject_fast() { boost::intrusive_ptr t = ::create_torrent(); sha1_hash ih = t->info_hash(); - session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48900, 49000)); + session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48900, 49000), "0.0.0.0", 0); ses1.add_torrent(t, "./tmp1"); test_sleep(2000); @@ -225,7 +225,7 @@ void test_respect_suggest() { boost::intrusive_ptr t = ::create_torrent(); sha1_hash ih = t->info_hash(); - session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48900, 49000)); + session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48900, 49000), "0.0.0.0", 0); ses1.add_torrent(t, "./tmp1"); test_sleep(2000); diff --git a/test/test_lsd.cpp b/test/test_lsd.cpp index 41e54b76b..0a62418d8 100644 --- a/test/test_lsd.cpp +++ b/test/test_lsd.cpp @@ -46,9 +46,9 @@ void test_lsd() { using namespace libtorrent; - session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48100, 49000)); - session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49100, 50000)); - session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50100, 51000)); + 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); // this is to avoid everything finish from a single peer // immediately. To make the swarm actually connect all diff --git a/test/test_pe_crypto.cpp b/test/test_pe_crypto.cpp index 348010063..469f8992a 100644 --- a/test/test_pe_crypto.cpp +++ b/test/test_pe_crypto.cpp @@ -80,8 +80,8 @@ void test_transfer(libtorrent::pe_settings::enc_policy policy, using namespace libtorrent; using std::cerr; - session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48800, 49000)); - session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49800, 50000)); + session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48800, 49000), "0.0.0.0", 0); + session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49800, 50000), "0.0.0.0", 0); pe_settings s; s.out_enc_policy = libtorrent::pe_settings::enabled; diff --git a/test/test_pex.cpp b/test/test_pex.cpp index ad3c6b3e9..490d3315b 100644 --- a/test/test_pex.cpp +++ b/test/test_pex.cpp @@ -47,9 +47,9 @@ void test_pex() { using namespace libtorrent; - session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48200, 49000)); - session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49200, 50000)); - session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50200, 51000)); + session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48200, 49000), "0.0.0.0", 0); + session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49200, 50000), "0.0.0.0", 0); + session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50200, 51000), "0.0.0.0", 0); // this is to avoid everything finish from a single peer // immediately. To make the swarm actually connect all diff --git a/test/test_storage.cpp b/test/test_storage.cpp index 6e7893cb0..873869478 100644 --- a/test/test_storage.cpp +++ b/test/test_storage.cpp @@ -429,7 +429,7 @@ void test_fastresume() entry resume; { - session ses; + session ses(fingerprint(" ", 0,0,0,0), 0); ses.set_alert_mask(alert::all_categories); torrent_handle h = ses.add_torrent(boost::intrusive_ptr(new torrent_info(*t)) @@ -455,7 +455,7 @@ void test_fastresume() // make sure the fast resume check fails! since we removed the file { - session ses; + session ses(fingerprint(" ", 0,0,0,0), 0); ses.set_alert_mask(alert::all_categories); torrent_handle h = ses.add_torrent(t, "tmp1", resume , storage_mode_compact); @@ -490,7 +490,7 @@ void test_rename_file_in_fastresume() entry resume; { - session ses; + session ses(fingerprint(" ", 0,0,0,0), 0); ses.set_alert_mask(alert::all_categories); torrent_handle h = ses.add_torrent(boost::intrusive_ptr(new torrent_info(*t)) @@ -519,7 +519,7 @@ void test_rename_file_in_fastresume() // make sure the fast resume check succeeds, even though we renamed the file { - session ses; + session ses(fingerprint(" ", 0,0,0,0), 0); ses.set_alert_mask(alert::all_categories); torrent_handle h = ses.add_torrent(t, "tmp2", resume , storage_mode_compact); diff --git a/test/test_swarm.cpp b/test/test_swarm.cpp index a6a7f323d..6e7dfc9fa 100644 --- a/test/test_swarm.cpp +++ b/test/test_swarm.cpp @@ -53,11 +53,11 @@ void test_swarm(bool super_seeding = false, bool strict = false) try { remove_all("./tmp2_swarm"); } catch (std::exception&) {} try { remove_all("./tmp3_swarm"); } catch (std::exception&) {} - session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48000, 49000)); + session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48000, 49000), "0.0.0.0", 0); ses1.set_alert_mask(alert::all_categories & ~alert::progress_notification); - session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49000, 50000)); + session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49000, 50000), "0.0.0.0", 0); ses2.set_alert_mask(alert::all_categories & ~alert::progress_notification); - session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50000, 51000)); + session ses3(fingerprint("LT", 0, 1, 0, 0), std::make_pair(50000, 51000), "0.0.0.0", 0); ses3.set_alert_mask(alert::all_categories & ~alert::progress_notification); diff --git a/test/test_torrent.cpp b/test/test_torrent.cpp index c345523b3..e41c139e0 100644 --- a/test/test_torrent.cpp +++ b/test/test_torrent.cpp @@ -13,7 +13,7 @@ using namespace libtorrent; void test_running_torrent(boost::intrusive_ptr info, size_type file_size) { - session ses(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48130, 48140)); + session ses(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48130, 48140), "0.0.0.0", 0); ses.set_alert_mask(alert::storage_notification); add_torrent_params p; diff --git a/test/test_transfer.cpp b/test/test_transfer.cpp index 84c0feb49..3da10941a 100644 --- a/test/test_transfer.cpp +++ b/test/test_transfer.cpp @@ -51,8 +51,8 @@ using boost::tuples::ignore; // test the maximum transfer rate void test_rate() { - session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48575, 49000)); - session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49575, 50000)); + session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48575, 49000), "0.0.0.0", 0); + session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49575, 50000), "0.0.0.0", 0); torrent_handle tor1; torrent_handle tor2; @@ -108,8 +108,8 @@ void print_alert(alert const& a) void test_transfer() { - session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48075, 49000)); - session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49075, 50000)); + session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48075, 49000), "0.0.0.0", 0); + session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49075, 50000), "0.0.0.0", 0); #ifndef TORRENT_DISABLE_ENCRYPTION pe_settings pes; diff --git a/test/test_web_seed.cpp b/test/test_web_seed.cpp index eaa8f180d..d2435064e 100644 --- a/test/test_web_seed.cpp +++ b/test/test_web_seed.cpp @@ -52,7 +52,7 @@ void test_transfer(boost::intrusive_ptr torrent_file, int proxy) { using namespace libtorrent; - session ses; + session ses(fingerprint(" ", 0,0,0,0), 0); session_settings settings; settings.ignore_limits_on_local_network = false; ses.set_settings(settings);