fix m_in_constructor assert for peer_connection (if the peer connection is constructed, but bt_peer_connection constructor fails, it needs to be cleared). Fix an invariant in session on ungraceful shutdown. Make test framework a bit more robust

This commit is contained in:
arvidn 2018-01-06 15:18:59 +01:00 committed by Arvid Norberg
parent bad0f01e07
commit 88643dd121
3 changed files with 6 additions and 5 deletions

View File

@ -184,6 +184,7 @@ namespace libtorrent {
#endif
#if TORRENT_USE_ASSERTS
piece_failed = false;
m_in_constructor = false;
#endif
}

View File

@ -869,6 +869,9 @@ namespace aux {
te.second->abort();
}
m_torrents.clear();
m_stats_counters.set_value(counters::num_peers_up_unchoked_all, 0);
m_stats_counters.set_value(counters::num_peers_up_unchoked, 0);
m_stats_counters.set_value(counters::num_peers_up_unchoked_optimistic, 0);
#ifndef TORRENT_DISABLE_LOGGING
session_log(" aborting all tracker requests");
@ -2941,9 +2944,6 @@ namespace {
std::shared_ptr<peer_connection> c
= std::make_shared<bt_peer_connection>(pack, get_peer_id());
#if TORRENT_USE_ASSERTS
c->m_in_constructor = false;
#endif
if (!c->is_disconnecting())
{

View File

@ -517,8 +517,8 @@ int EXPORT main(int argc, char const* argv[])
fclose(t.output);
}
if (redirect_stdout) dup2(old_stdout, fileno(stdout));
if (redirect_stderr) dup2(old_stderr, fileno(stderr));
if (redirect_stdout && old_stdout != -1) dup2(old_stdout, fileno(stdout));
if (redirect_stderr && old_stderr != -1) dup2(old_stderr, fileno(stderr));
if (!tests_to_run.empty())
{