add debug configuration to debug shutdown-stall bugs / outstanding async operations

This commit is contained in:
Arvid Norberg
2010-11-28 01:47:30 +00:00
parent af6ac4aca9
commit 2e871382d7
14 changed files with 437 additions and 0 deletions

View File

@@ -37,6 +37,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/error_code.hpp"
#include "libtorrent/error.hpp"
#if defined TORRENT_ASIO_DEBUGGING
#include "libtorrent/debug.hpp"
#endif
namespace libtorrent
{
@@ -203,6 +207,9 @@ namespace libtorrent
ptime expire = time_now_hires() + i->timeout;
if (m_num_connecting == 0)
{
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("connection_queue::on_timeout");
#endif
error_code ec;
m_timer.expires_at(expire, ec);
m_timer.async_wait(boost::bind(&connection_queue::on_timeout, this, _1));
@@ -253,6 +260,9 @@ namespace libtorrent
void connection_queue::on_timeout(error_code const& e)
{
#if defined TORRENT_ASIO_DEBUGGING
complete_async("connection_queue::on_timeout");
#endif
mutex_t::scoped_lock l(m_mutex);
INVARIANT_CHECK;
@@ -302,6 +312,9 @@ namespace libtorrent
if (next_expire < max_time())
{
#if defined TORRENT_ASIO_DEBUGGING
add_outstanding_async("connection_queue::on_timeout");
#endif
error_code ec;
m_timer.expires_at(next_expire, ec);
m_timer.async_wait(boost::bind(&connection_queue::on_timeout, this, _1));