From 7d2d9dd9c1119346f0adf02b70ef4a6f05038df6 Mon Sep 17 00:00:00 2001 From: arvidn Date: Thu, 20 Aug 2015 22:11:04 +0200 Subject: [PATCH] don't destruct sessions in global destructors --- test/test_priority.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/test/test_priority.cpp b/test/test_priority.cpp index 81738aab4..f99212419 100644 --- a/test/test_priority.cpp +++ b/test/test_priority.cpp @@ -64,11 +64,6 @@ bool on_alert(alert const* a) return false; } -// these are declared before the session objects -// so that they are destructed last. This enables -// the sessions to destruct in parallel -std::vector sp; - void cleanup() { error_code ec; @@ -80,6 +75,9 @@ void cleanup() void test_transfer(settings_pack const& sett) { + // this allows shutting down the sessions in parallel + std::vector sp; + cleanup(); settings_pack pack = sett; @@ -163,7 +161,7 @@ void test_transfer(settings_pack const& sett) if (st2.state != torrent_status::downloading) { - static char const* state_str[] = + static char const* state_str[] = {"checking (q)", "checking", "dl metadata" , "downloading", "finished", "seeding", "allocating", "checking (r)"}; std::cerr << "st2 state: " << state_str[st2.state] << std::endl; @@ -368,7 +366,6 @@ done: fprintf(stderr, "ses2 failed to reconnect to ses1!\n"); TEST_CHECK(st2.is_seeding); - // this allows shutting down the sessions in parallel sp.push_back(ses1.abort()); sp.push_back(ses2.abort()); }