Skip to content

Commit

Permalink
remove misleading (and redundant) peer log message
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Feb 1, 2021
1 parent 834f477 commit ef15770
Showing 1 changed file with 14 additions and 32 deletions.
46 changes: 14 additions & 32 deletions src/peer_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2416,8 +2416,6 @@ namespace libtorrent {
// we shouldn't get a request
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "INVALID_REQUEST", "we don't have metadata yet");
peer_log(peer_log_alert::outgoing_message, "REJECT_PIECE", "piece: %d s: %x l: %x no metadata"
, static_cast<int>(r.piece), r.start, r.length);
#endif
write_reject_request(r);
return;
Expand All @@ -2433,8 +2431,6 @@ namespace libtorrent {
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "INVALID_REQUEST", "incoming request queue full %d"
, int(m_requests.size()));
peer_log(peer_log_alert::outgoing_message, "REJECT_PIECE", "piece: %d s: %x l: %x too many requests"
, static_cast<int>(r.piece), r.start, r.length);
#endif
write_reject_request(r);
return;
Expand Down Expand Up @@ -2501,10 +2497,6 @@ namespace libtorrent {
, t->has_piece_passed(r.piece)
, t->block_size());
}

peer_log(peer_log_alert::outgoing_message, "REJECT_PIECE"
, "piece: %d s: %d l: %d invalid request"
, static_cast<int>(r.piece), r.start , r.length);
#endif

write_reject_request(r);
Expand Down Expand Up @@ -2561,8 +2553,6 @@ namespace libtorrent {
{
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "REJECTING REQUEST", "peer choked and piece not in allowed fast set");
peer_log(peer_log_alert::outgoing_message, "REJECT_PIECE", "piece: %d s: %d l: %d peer choked"
, static_cast<int>(r.piece), r.start, r.length);
#endif
m_counters.inc_stats_counter(counters::choked_piece_requests);
write_reject_request(r);
Expand Down Expand Up @@ -3267,10 +3257,6 @@ namespace libtorrent {
if (m_requests.empty())
m_counters.inc_stats_counter(counters::num_peers_up_requests, -1);

#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::outgoing_message, "REJECT_PIECE", "piece: %d s: %x l: %x cancelled"
, static_cast<int>(r.piece), r.start , r.length);
#endif
write_reject_request(r);
}
else
Expand Down Expand Up @@ -3820,11 +3806,6 @@ namespace libtorrent {
}
peer_request const& r = *i;
m_counters.inc_stats_counter(counters::choked_piece_requests);
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::outgoing_message, "REJECT_PIECE"
, "piece: %d s: %d l: %d choking"
, static_cast<int>(r.piece), r.start , r.length);
#endif
write_reject_request(r);
i = m_requests.erase(i);

Expand Down Expand Up @@ -5224,6 +5205,18 @@ namespace libtorrent {
}
#endif

if (t->is_deleted())
{
// can this happen here?
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "TORRENT_ABORTED", "");
#endif
for (peer_request const& r : m_requests)
write_reject_request(r);
m_requests.clear();
return;
}

// don't just pop the front element here, since in seed mode one request may
// be blocked because we have to verify the hash first, so keep going with the
// next request. However, only let each peer have one hash verification outstanding
Expand All @@ -5240,17 +5233,6 @@ namespace libtorrent {
TORRENT_ASSERT(r.length > 0);
TORRENT_ASSERT(r.start >= 0);

if (t->is_deleted())
{
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::outgoing_message, "REJECT_PIECE"
, "piece: %d s: %x l: %x torrent deleted"
, static_cast<int>(r.piece), r.start , r.length);
#endif
write_reject_request(r);
continue;
}

bool const seed_mode = t->seed_mode();

if (seed_mode
Expand Down Expand Up @@ -5299,8 +5281,8 @@ namespace libtorrent {
if (t->is_predictive_piece(r.piece)) continue;
#endif
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::outgoing_message, "REJECT_PIECE"
, "piece: %d s: %x l: %x piece not passed hash check"
peer_log(peer_log_alert::info, "PIECE_FAILED"
, "piece: %d s: %x l: %x piece failed hash check"
, static_cast<int>(r.piece), r.start , r.length);
#endif
write_reject_request(r);
Expand Down

0 comments on commit ef15770

Please sign in to comment.