forked from premiere/premiere-libtorrent
don't destruct sessions in global destructors
This commit is contained in:
parent
fa450b4bf7
commit
7d2d9dd9c1
|
@ -64,11 +64,6 @@ bool on_alert(alert const* a)
|
||||||
return false;
|
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<session_proxy> sp;
|
|
||||||
|
|
||||||
void cleanup()
|
void cleanup()
|
||||||
{
|
{
|
||||||
error_code ec;
|
error_code ec;
|
||||||
|
@ -80,6 +75,9 @@ void cleanup()
|
||||||
|
|
||||||
void test_transfer(settings_pack const& sett)
|
void test_transfer(settings_pack const& sett)
|
||||||
{
|
{
|
||||||
|
// this allows shutting down the sessions in parallel
|
||||||
|
std::vector<session_proxy> sp;
|
||||||
|
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
settings_pack pack = sett;
|
settings_pack pack = sett;
|
||||||
|
@ -163,7 +161,7 @@ void test_transfer(settings_pack const& sett)
|
||||||
|
|
||||||
if (st2.state != torrent_status::downloading)
|
if (st2.state != torrent_status::downloading)
|
||||||
{
|
{
|
||||||
static char const* state_str[] =
|
static char const* state_str[] =
|
||||||
{"checking (q)", "checking", "dl metadata"
|
{"checking (q)", "checking", "dl metadata"
|
||||||
, "downloading", "finished", "seeding", "allocating", "checking (r)"};
|
, "downloading", "finished", "seeding", "allocating", "checking (r)"};
|
||||||
std::cerr << "st2 state: " << state_str[st2.state] << std::endl;
|
std::cerr << "st2 state: " << state_str[st2.state] << std::endl;
|
||||||
|
@ -368,7 +366,6 @@ done:
|
||||||
fprintf(stderr, "ses2 failed to reconnect to ses1!\n");
|
fprintf(stderr, "ses2 failed to reconnect to ses1!\n");
|
||||||
TEST_CHECK(st2.is_seeding);
|
TEST_CHECK(st2.is_seeding);
|
||||||
|
|
||||||
// this allows shutting down the sessions in parallel
|
|
||||||
sp.push_back(ses1.abort());
|
sp.push_back(ses1.abort());
|
||||||
sp.push_back(ses2.abort());
|
sp.push_back(ses2.abort());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue