diff --git a/test/test_metadata_extension.cpp b/test/test_metadata_extension.cpp index 771e72c82..3a858a689 100644 --- a/test/test_metadata_extension.cpp +++ b/test/test_metadata_extension.cpp @@ -90,7 +90,7 @@ void test_transfer(bool clear_files, bool disconnect test_sleep(100); } - if (disconnect) return; + if (disconnect) goto done; TEST_CHECK(tor2.status().has_metadata); TEST_CHECK(tor3.status().has_metadata); @@ -109,6 +109,8 @@ void test_transfer(bool clear_files, bool disconnect TEST_CHECK(tor2.status().is_seeding); if (tor2.status().is_seeding) std::cerr << "done\n"; +done: + // this allows shutting down the sessions in parallel p1 = ses1.abort(); p2 = ses2.abort(); diff --git a/test/test_trackers_extension.cpp b/test/test_trackers_extension.cpp index 22c0ccf7f..2b140ad45 100644 --- a/test/test_trackers_extension.cpp +++ b/test/test_trackers_extension.cpp @@ -48,6 +48,12 @@ int test_main() { using namespace libtorrent; + // these are declared before the session objects + // so that they are destructed last. This enables + // the sessions to destruct in parallel + session_proxy p1; + session_proxy p2; + session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48130, 49000), "0.0.0.0", 0); session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49130, 50000), "0.0.0.0", 0); ses1.add_extension(create_lt_trackers_plugin); @@ -116,6 +122,10 @@ int test_main() TEST_CHECK(tor1.trackers().size() == 1); + // this allows shutting down the sessions in parallel + p1 = ses1.abort(); + p2 = ses2.abort(); + return 0; }