extend verbose logging to try to catch test_priority failure on windows

This commit is contained in:
Arvid Norberg 2014-01-26 04:45:49 +00:00
parent 05aa06460d
commit f0d1e8636c
3 changed files with 44 additions and 4 deletions

View File

@ -1874,6 +1874,11 @@ namespace libtorrent
// connections, don't sent upload-only
if (!m_ses.settings().close_redundant_connections) return;
#ifdef TORRENT_VERBOSE_LOGGING
peer_log("==> UPLOAD_ONLY [ %d ]"
, int(t->is_upload_only() && !t->super_seeding()));
#endif
char msg[7] = {0, 0, 0, 3, msg_extended};
char* ptr = msg + 5;
detail::write_uint8(m_upload_only_id, ptr);

View File

@ -501,8 +501,20 @@ namespace libtorrent
// if m_have_piece is 0, it means the connections
// have not been initialized yet. The interested
// flag will be updated once they are.
if (m_have_piece.size() == 0) return;
if (!t->ready_for_connections()) return;
if (m_have_piece.size() == 0)
{
#if defined TORRENT_VERBOSE_LOGGING
peer_log("*** UPDATE_INTEREST [ connections not initialized ]");
#endif
return;
}
if (!t->ready_for_connections())
{
#if defined TORRENT_VERBOSE_LOGGING
peer_log("*** UPDATE_INTEREST [ not ready for connections ]");
#endif
return;
}
bool interested = false;
if (!t->is_upload_only())
@ -516,10 +528,21 @@ namespace libtorrent
&& m_have_piece[j])
{
interested = true;
#if defined TORRENT_VERBOSE_LOGGING
peer_log("*** UPDATE_INTEREST [ interesting, piece: %d ]", j);
#endif
break;
}
}
}
#if defined TORRENT_VERBOSE_LOGGING
if (!interested)
{
peer_log("*** UPDATE_INTEREST [ not interesting ]");
}
#endif
if (!interested) send_not_interested();
else t->get_policy().peer_is_interesting(*this);

View File

@ -938,7 +938,6 @@ namespace libtorrent
++i;
if (p->type() == peer_connection::bittorrent_connection)
p->write_upload_only();
p->disconnect_if_redundant();
}
#endif
}
@ -4088,6 +4087,11 @@ namespace libtorrent
p->update_interest();
}
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
debug_log("*** UPDATE_PEER_INTEREST [ finished: %d was_finished %d ]"
, is_finished(), was_finished);
#endif
// the torrent just became finished
if (is_finished() && !was_finished)
{
@ -6302,7 +6306,13 @@ namespace libtorrent
if (m_state == torrent_status::checking_resume_data
|| m_state == torrent_status::checking_files
|| m_state == torrent_status::allocating)
{
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
debug_log("*** RESUME_DOWNLOAD [ skipping, state: %d ]"
, int(m_state));
#endif
return;
}
TORRENT_ASSERT(!is_finished());
set_state(torrent_status::downloading);
@ -6311,6 +6321,9 @@ namespace libtorrent
m_completed_time = 0;
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
debug_log("*** RESUME_DOWNLOAD");
#endif
send_upload_only();
}
@ -8994,7 +9007,6 @@ namespace libtorrent
update_tracker_timer(time_now());
}
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
void torrent::debug_log(const char* fmt, ...) const
{