minor fix to invalid_request_alert logging

This commit is contained in:
arvidn 2018-12-22 17:26:12 +02:00 committed by Arvid Norberg
parent 54fd03529e
commit 97e86b2969
2 changed files with 4 additions and 7 deletions

View File

@ -536,7 +536,7 @@ namespace libtorrent {
std::string invalid_request_alert::message() const
{
char ret[200];
char ret[400];
std::snprintf(ret, sizeof(ret), "%s peer sent an invalid piece request "
"(piece: %d start: %d len: %d)%s"
, peer_alert::message().c_str()

View File

@ -2306,7 +2306,7 @@ namespace libtorrent {
{
// msvc 12 appears to deduce the rvalue reference template
// incorrectly for bool temporaries. So, create a dummy instance
bool peer_interested = bool(m_peer_interested);
bool const peer_interested = bool(m_peer_interested);
t->alerts().emplace_alert<invalid_request_alert>(
t->get_handle(), m_remote, m_peer_id, r
, t->has_piece_passed(r.piece), peer_interested, true);
@ -2379,13 +2379,10 @@ namespace libtorrent {
#endif
if (t->alerts().should_post<invalid_request_alert>())
{
// msvc 12 appears to deduce the rvalue reference template
// incorrectly for bool temporaries. So, create a dummy instance
bool peer_interested = bool(m_peer_interested);
t->alerts().emplace_alert<invalid_request_alert>(
t->get_handle(), m_remote, m_peer_id, r
, t->has_piece_passed(r.piece)
, peer_interested, false);
, false, false);
}
// be lenient and pretend that the peer said it was interested
@ -2433,7 +2430,7 @@ namespace libtorrent {
{
// msvc 12 appears to deduce the rvalue reference template
// incorrectly for bool temporaries. So, create a dummy instance
bool peer_interested = bool(m_peer_interested);
bool const peer_interested = bool(m_peer_interested);
t->alerts().emplace_alert<invalid_request_alert>(
t->get_handle(), m_remote, m_peer_id, r
, t->has_piece_passed(r.piece), peer_interested, false);