improve peer debug logging

This commit is contained in:
arvidn 2018-11-24 15:24:04 +02:00 committed by Arvid Norberg
parent 35ec87af4f
commit 7a51813d32
9 changed files with 169 additions and 121 deletions

View File

@ -541,6 +541,8 @@ namespace libtorrent {
#endif
};
// internal
std::string print_error(error_code const&);
}
namespace boost { namespace system {

View File

@ -526,7 +526,6 @@ namespace aux {
time_point m_connect_time;
time_point m_bitfield_time;
time_point m_unchoke_time;
#endif
// the message handlers are called

View File

@ -1436,7 +1436,7 @@ namespace {
if (should_log(peer_log_alert::incoming_message))
{
peer_log(peer_log_alert::incoming_message, "HOLEPUNCH"
, "msg:connect to: %s error: failed to add peer"
, "msg:connect to: %s ERROR: failed to add peer"
, print_address(ep.address()).c_str());
}
#endif
@ -1450,7 +1450,7 @@ namespace {
if (should_log(peer_log_alert::incoming_message))
{
peer_log(peer_log_alert::incoming_message, "HOLEPUNCH"
, "msg:connect to: %s error: peer banned", print_address(ep.address()).c_str());
, "msg:connect to: %s ERROR: peer banned", print_address(ep.address()).c_str());
}
#endif
// this peer is banned, don't connect to it
@ -1484,7 +1484,7 @@ namespace {
{
static char const* err_msg[] = {"no such peer", "not connected", "no support", "no self"};
peer_log(peer_log_alert::incoming_message, "HOLEPUNCH"
, "msg:failed error: %d msg: %s", error
, "msg:failed ERROR: %d msg: %s", error
, ((error > 0 && error < 5)?err_msg[error-1]:"unknown message id"));
}
#endif
@ -1510,7 +1510,7 @@ namespace {
static const char* hp_msg_name[] = {"rendezvous", "connect", "failed"};
static const char* hp_error_string[] = {"", "no such peer", "not connected", "no support", "no self"};
peer_log(peer_log_alert::outgoing_message, "HOLEPUNCH"
, "msg: %s to: %s error: %s"
, "msg: %s to: %s ERROR: %s"
, (static_cast<std::uint8_t>(type) < 3
? hp_msg_name[static_cast<std::uint8_t>(type)]
: "unknown message type")
@ -1584,7 +1584,7 @@ namespace {
#endif
return;
}
bool ul = aux::read_uint8(recv_buffer) != 0;
bool const ul = aux::read_uint8(recv_buffer) != 0;
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::incoming_message, "UPLOAD_ONLY"
, "%s", (ul?"true":"false"));
@ -1675,8 +1675,8 @@ namespace {
if (should_log(peer_log_alert::info))
{
peer_log(peer_log_alert::info, "EXTENSION_MESSAGE"
, "invalid extended handshake: %s pos: %d"
, ec.message().c_str(), pos);
, "invalid extended handshake. pos: %d %s"
, pos, print_error(ec).c_str());
}
#endif
return;

View File

@ -34,6 +34,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/error_code.hpp"
#include "libtorrent/string_util.hpp" // for to_string()
#include <sstream>
namespace libtorrent {
struct libtorrent_error_category : boost::system::error_category
@ -332,4 +334,13 @@ namespace libtorrent {
}
}
std::string print_error(error_code const& ec)
{
if (!ec) return {};
std::stringstream ret;
ret << "ERROR: (" << ec.category().name() << ":" << ec.value() << ") "
<< ec.message();
return ret.str();
}
}

View File

@ -255,7 +255,7 @@ namespace libtorrent {
{
TORRENT_UNUSED(e);
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "PEER_ERROR" ,"error: %s"
peer_log(peer_log_alert::info, "PEER_ERROR", "ERROR: %s"
, e.what());
#endif
disconnect(error_code(), operation_t::unknown, peer_error);
@ -370,11 +370,14 @@ namespace libtorrent {
#ifndef TORRENT_DISABLE_LOGGING
if (should_log(peer_log_alert::info))
{
std::string classes;
for (int i = 0; i < num_classes(); ++i)
{
peer_log(peer_log_alert::info, "CLASS", "%s"
, m_ses.peer_classes().at(class_at(i))->label.c_str());
classes += m_ses.peer_classes().at(class_at(i))->label;
classes += ' ';
}
peer_log(peer_log_alert::info, "CLASS", "%s"
, classes.c_str());
}
#endif
@ -428,12 +431,6 @@ namespace libtorrent {
#endif
ADD_OUTSTANDING_ASYNC("peer_connection::on_connection_complete");
#ifndef TORRENT_DISABLE_LOGGING
if (t && t->should_log())
t->debug_log("START connect [%p] (%d)", static_cast<void*>(this)
, t->num_peers());
#endif
auto conn = self();
m_socket->async_connect(m_remote
, [conn](error_code const& e) { conn->wrap(&peer_connection::on_connection_complete, e); });
@ -1641,12 +1638,6 @@ namespace libtorrent {
std::shared_ptr<torrent> t = m_torrent.lock();
TORRENT_ASSERT(t);
#ifndef TORRENT_DISABLE_LOGGING
m_unchoke_time = clock_type::now();
t->debug_log("UNCHOKE [%p] (%d ms)", static_cast<void*>(this)
, int(total_milliseconds(m_unchoke_time - m_bitfield_time)));
#endif
#ifndef TORRENT_DISABLE_EXTENSIONS
for (auto const& e : m_extensions)
{
@ -2844,12 +2835,6 @@ namespace libtorrent {
}
#ifndef TORRENT_DISABLE_LOGGING
if (t->should_log())
{
t->debug_log("PIECE [%p] (%d ms) (%d)", static_cast<void*>(this)
, int(total_milliseconds(now - m_unchoke_time)), t->num_have());
}
peer_log(peer_log_alert::info, "FILE_ASYNC_WRITE", "piece: %d s: %x l: %x"
, static_cast<int>(p.piece), p.start, p.length);
#endif
@ -3348,14 +3333,6 @@ namespace libtorrent {
TORRENT_ASSERT(t);
#ifndef TORRENT_DISABLE_LOGGING
if (t->should_log())
{
time_point const now = clock_type::now();
t->debug_log("ALLOW FAST [%p] (%d ms)"
, static_cast<void*>(this)
, int(total_milliseconds(now - m_connect_time)));
if (m_peer_choked) m_unchoke_time = now;
}
peer_log(peer_log_alert::incoming_message, "ALLOWED_FAST", "%d"
, static_cast<int>(index));
#endif
@ -4046,9 +4023,6 @@ namespace libtorrent {
// previously did not have a request. That's when we start the
// request timeout.
m_requested = aux::time_now();
#ifndef TORRENT_DISABLE_LOGGING
t->debug_log("REQUEST [%p]", static_cast<void*>(this));
#endif
}
}
@ -4061,7 +4035,7 @@ namespace libtorrent {
if (should_log(peer_log_alert::info))
{
peer_log(peer_log_alert::info, "CONNECTION FAILED"
, "%s", print_endpoint(m_remote).c_str());
, "%s %s", print_endpoint(m_remote).c_str(), print_error(e).c_str());
}
#endif
#ifndef TORRENT_DISABLE_LOGGING
@ -4166,8 +4140,8 @@ namespace libtorrent {
{
static aux::array<char const*, 3, disconnect_severity_t> const str{{{
"CONNECTION_CLOSED", "CONNECTION_FAILED", "PEER_ERROR"}}};
peer_log(peer_log_alert::info, str[error], "op: %d error: %s"
, static_cast<int>(op), ec.message().c_str());
peer_log(peer_log_alert::info, str[error], "op: %d %s"
, static_cast<int>(op), print_error(ec).c_str());
if (ec == boost::asio::error::eof
&& !in_handshake()
@ -4179,7 +4153,7 @@ namespace libtorrent {
}
catch (std::exception const& err)
{
peer_log(peer_log_alert::info, "PEER_ERROR" ,"op: %d error: unknown error (failed with exception) %s"
peer_log(peer_log_alert::info, "PEER_ERROR" ,"op: %d ERROR: unknown error (failed with exception) %s"
, static_cast<int>(op), err.what());
}
#endif
@ -5808,9 +5782,8 @@ namespace libtorrent {
if (should_log(peer_log_alert::incoming))
{
peer_log(peer_log_alert::incoming, "ON_RECEIVE_DATA"
, "bytes: %d error: (%s:%d) %s"
, int(bytes_transferred), error.category().name(), error.value()
, error.message().c_str());
, "bytes: %d %s"
, int(bytes_transferred), print_error(error).c_str());
}
#endif
@ -5831,8 +5804,8 @@ namespace libtorrent {
if (should_log(peer_log_alert::info))
{
peer_log(peer_log_alert::info, "ERROR"
, "in peer_connection::on_receive_data_impl error: %s"
, error.message().c_str());
, "in peer_connection::on_receive_data_impl %s"
, print_error(error).c_str());
}
#endif
on_receive(error, bytes_transferred);
@ -6015,11 +5988,7 @@ namespace libtorrent {
INVARIANT_CHECK;
#ifndef TORRENT_DISABLE_LOGGING
{
std::shared_ptr<torrent> t = m_torrent.lock();
if (t) t->debug_log("END connect [%p]", static_cast<void*>(this));
m_connect_time = aux::time_now();
}
m_connect_time = aux::time_now();
#endif
// if t is nullptr, we better not be connecting, since
@ -6174,8 +6143,8 @@ namespace libtorrent {
#ifndef TORRENT_DISABLE_LOGGING
if (should_log(peer_log_alert::info))
{
peer_log(peer_log_alert::info, "ON_SEND_DATA", "bytes: %d error: %s"
, int(bytes_transferred), error.message().c_str());
peer_log(peer_log_alert::info, "ON_SEND_DATA", "bytes: %d %s"
, int(bytes_transferred), print_error(error).c_str());
}
#endif

View File

@ -534,8 +534,9 @@ namespace aux {
#ifndef TORRENT_DISABLE_LOGGING
if (should_log())
{
session_log(" max connections: %d", m_settings.get_int(settings_pack::connections_limit));
session_log(" max files: %d", max_files);
session_log("max-connections: %d max-files: %d"
, m_settings.get_int(settings_pack::connections_limit)
, max_files);
}
#endif
@ -1884,6 +1885,7 @@ namespace aux {
#ifndef BOOST_NO_EXCEPTIONS
catch (std::exception const& e)
{
TORRENT_UNUSED(e);
#ifndef TORRENT_DISABLE_LOGGING
if (should_log())
{
@ -2727,27 +2729,19 @@ namespace aux {
#ifndef TORRENT_DISABLE_LOGGING
if (should_log())
{
session_log(" <== INCOMING CONNECTION FAILED, could "
"not retrieve remote endpoint: %s"
, ec.message().c_str());
session_log(" <== INCOMING CONNECTION [ rejected, could "
"not retrieve remote endpoint: %s ]"
, print_error(ec).c_str());
}
#endif
return;
}
#ifndef TORRENT_DISABLE_LOGGING
if (should_log())
{
session_log(" <== INCOMING CONNECTION %s type: %s"
, print_endpoint(endp).c_str(), s->type_name());
}
#endif
if (!m_settings.get_bool(settings_pack::enable_incoming_utp)
&& is_utp(*s))
{
#ifndef TORRENT_DISABLE_LOGGING
session_log(" rejected uTP connection");
session_log("<== INCOMING CONNECTION [ rejected uTP connection ]");
#endif
if (m_alerts.should_post<peer_blocked_alert>())
m_alerts.emplace_alert<peer_blocked_alert>(torrent_handle()
@ -2759,7 +2753,7 @@ namespace aux {
&& s->get<tcp::socket>())
{
#ifndef TORRENT_DISABLE_LOGGING
session_log(" rejected TCP connection");
session_log("<== INCOMING CONNECTION [ rejected TCP connection ]");
#endif
if (m_alerts.should_post<peer_blocked_alert>())
m_alerts.emplace_alert<peer_blocked_alert>(torrent_handle()
@ -2777,8 +2771,8 @@ namespace aux {
#ifndef TORRENT_DISABLE_LOGGING
if (should_log())
{
session_log(" rejected connection: (%d) %s", ec.value()
, ec.message().c_str());
session_log("<== INCOMING CONNECTION [ rejected connection: %s ]"
, print_error(ec).c_str());
}
#endif
return;
@ -2790,7 +2784,7 @@ namespace aux {
if (should_log())
{
error_code err;
session_log(" rejected connection, local interface has incoming connections disabled: %s"
session_log("<== INCOMING CONNECTION [ rejected, local interface has incoming connections disabled: %s ]"
, local.address().to_string(err).c_str());
}
#endif
@ -2799,16 +2793,15 @@ namespace aux {
, endp, peer_blocked_alert::invalid_local_interface);
return;
}
if (!verify_bound_address(local.address()
, is_utp(*s), ec))
if (!verify_bound_address(local.address(), is_utp(*s), ec))
{
if (ec)
{
#ifndef TORRENT_DISABLE_LOGGING
if (should_log())
{
session_log(" rejected connection, not allowed local interface: (%d) %s"
, ec.value(), ec.message().c_str());
session_log("<== INCOMING CONNECTION [ rejected, not allowed local interface: %s ]"
, print_error(ec).c_str());
}
#endif
return;
@ -2818,7 +2811,7 @@ namespace aux {
if (should_log())
{
error_code err;
session_log(" rejected connection, not allowed local interface: %s"
session_log("<== INCOMING CONNECTION [ rejected, not allowed local interface: %s ]"
, local.address().to_string(err).c_str());
}
#endif
@ -2844,7 +2837,7 @@ namespace aux {
&& (m_ip_filter->access(endp.address()) & ip_filter::blocked))
{
#ifndef TORRENT_DISABLE_LOGGING
session_log("filtered blocked ip");
session_log("<== INCOMING CONNECTION [ filtered blocked ip ]");
#endif
if (m_alerts.should_post<peer_blocked_alert>())
m_alerts.emplace_alert<peer_blocked_alert>(torrent_handle()
@ -2857,7 +2850,7 @@ namespace aux {
if (m_torrents.empty())
{
#ifndef TORRENT_DISABLE_LOGGING
session_log(" There are no torrents, disconnect");
session_log("<== INCOMING CONNECTION [ rejected, there are no torrents ]");
#endif
return;
}
@ -2895,7 +2888,7 @@ namespace aux {
#ifndef TORRENT_DISABLE_LOGGING
if (should_log())
{
session_log("number of connections limit exceeded (conns: %d, limit: %d, slack: %d), connection rejected"
session_log("<== INCOMING CONNECTION [ connections limit exceeded, conns: %d, limit: %d, slack: %d ]"
, num_connections(), m_settings.get_int(settings_pack::connections_limit)
, m_settings.get_int(settings_pack::connections_slack));
}
@ -2916,7 +2909,7 @@ namespace aux {
if (!has_active_torrent)
{
#ifndef TORRENT_DISABLE_LOGGING
session_log(" There are no _active_ torrents, disconnect");
session_log("<== INCOMING CONNECTION [ rejected, no active torrents ]");
#endif
return;
}
@ -2934,9 +2927,9 @@ namespace aux {
if (err && should_log())
{
error_code ignore;
session_log("socket buffer size [ %s %d]: (%d) %s"
session_log("socket buffer size [ %s %d ]: %s"
, s->local_endpoint().address().to_string(ignore).c_str()
, s->local_endpoint().port(), err.value(), err.message().c_str());
, s->local_endpoint().port(), print_error(err).c_str());
}
#endif
}
@ -5522,11 +5515,16 @@ namespace aux {
if (t->torrent_file().priv() || (t->torrent_file().is_i2p()
&& !m_settings.get_bool(settings_pack::allow_i2p_mixed))) return;
t->add_peer(peer, peer_info::lsd);
#ifndef TORRENT_DISABLE_LOGGING
if (should_log())
session_log("added peer from local discovery: %s", print_endpoint(peer).c_str());
{
error_code ec;
t->debug_log("lsd add_peer() [ %s ]"
, peer.address().to_string(ec).c_str());
}
#endif
t->add_peer(peer, peer_info::lsd);
t->do_connect_boost();
if (m_alerts.should_post<lsd_peer_alert>())
@ -6932,22 +6930,19 @@ namespace aux {
void session_impl::set_external_address(std::shared_ptr<listen_socket_t> const& sock
, address const& ip, ip_source_t const source_type, address const& source)
{
if (!sock->external_address.cast_vote(ip, source_type, source)) return;
#ifndef TORRENT_DISABLE_LOGGING
if (should_log())
{
session_log(": set_external_address(%s, %d, %s)"
session_log("external address updated for %s [ new-ip: %s type: %d last-voter: %s ]"
, sock->device.empty() ? print_endpoint(sock->local_endpoint).c_str() : sock->device.c_str()
, print_address(ip).c_str()
, static_cast<std::uint8_t>(source_type)
, print_address(source).c_str());
}
#endif
if (!sock->external_address.cast_vote(ip, source_type, source)) return;
#ifndef TORRENT_DISABLE_LOGGING
session_log(" external IP updated");
#endif
if (m_alerts.should_post<external_ip_alert>())
m_alerts.emplace_alert<external_ip_alert>(ip);

View File

@ -76,16 +76,18 @@ namespace {
void on_piece_pass(piece_index_t const p) override
{
#ifndef TORRENT_DISABLE_LOGGING
m_torrent.debug_log(" PIECE PASS [ p: %d | block_hash_size: %d ]"
, static_cast<int>(p), int(m_block_hashes.size()));
#endif
// has this piece failed earlier? If it has, go through the
// CRCs from the time it failed and ban the peers that
// sent bad blocks
auto i = m_block_hashes.lower_bound(piece_block(p, 0));
if (i == m_block_hashes.end() || i->first.piece_index != p) return;
#ifndef TORRENT_DISABLE_LOGGING
if (m_torrent.should_log())
m_torrent.debug_log("PIECE PASS [ p: %d | block_hash_size: %d ]"
, static_cast<int>(p), int(m_block_hashes.size()));
#endif
int size = m_torrent.torrent_file().piece_size(p);
peer_request r = {p, 0, std::min(16 * 1024, size)};
piece_block pb(p, 0);
@ -215,7 +217,7 @@ namespace {
p->connection->get_peer_info(info);
client = info.client.c_str();
}
m_torrent.debug_log(" BANNING PEER [ p: %d | b: %d | c: %s"
m_torrent.debug_log("BANNING PEER [ p: %d | b: %d | c: %s"
" | hash1: %s | hash2: %s | ip: %s ]"
, static_cast<int>(b.piece_index), b.block_index, client
, aux::to_hex(i->second.digest).c_str()
@ -244,7 +246,7 @@ namespace {
p->connection->get_peer_info(info);
client = info.client.c_str();
}
m_torrent.debug_log(" STORE BLOCK CRC [ p: %d | b: %d | c: %s"
m_torrent.debug_log("STORE BLOCK CRC [ p: %d | b: %d | c: %s"
" | digest: %s | ip: %s ]"
, static_cast<int>(b.piece_index), b.block_index, client
, aux::to_hex(e.digest).c_str()
@ -290,7 +292,7 @@ namespace {
p->connection->get_peer_info(info);
client = info.client.c_str();
}
m_torrent.debug_log(" BANNING PEER [ p: %d | b: %d | c: %s"
m_torrent.debug_log("BANNING PEER [ p: %d | b: %d | c: %s"
" | ok_digest: %s | bad_digest: %s | ip: %s ]"
, static_cast<int>(b.first.piece_index), b.first.block_index, client
, aux::to_hex(ok_digest).c_str()

View File

@ -633,6 +633,22 @@ bool is_downloading_state(int const st)
{
add_peer(peer, peer_info::resume_data);
}
#ifndef TORRENT_DISABLE_LOGGING
if (should_log())
{
std::string str;
for (auto const& peer : p.peers)
{
error_code ec;
str += peer.address().to_string(ec);
str += ' ';
}
debug_log("add_torrent add_peer() [ %s] connect-candidates: %d"
, str.c_str(), m_peer_list
? m_peer_list->num_connect_candidates() : -1);
}
#endif
}
#ifndef TORRENT_DISABLE_LOGGING
@ -2007,6 +2023,22 @@ bool is_downloading_state(int const st)
add_peer(p , peer_info::resume_data);
}
#ifndef TORRENT_DISABLE_LOGGING
if (should_log())
{
error_code ec;
std::string str;
for (auto const& peer : m_add_torrent_params->peers)
{
str += peer.address().to_string(ec);
str += ' ';
}
debug_log("resume-checked add_peer() [ %s] connect-candidates: %d"
, str.c_str(), m_peer_list
? m_peer_list->num_connect_candidates() : -1);
}
#endif
for (auto const& p : m_add_torrent_params->banned_peers)
{
torrent_peer* peer = add_peer(p, peer_info::resume_data);
@ -2021,7 +2053,8 @@ bool is_downloading_state(int const st)
#ifndef TORRENT_DISABLE_LOGGING
if (m_peer_list && m_peer_list->num_peers() > 0)
debug_log("resume added peers (%d)", m_peer_list->num_peers());
debug_log("resume added peers (total peers: %d)"
, m_peer_list->num_peers());
#endif
}
@ -2639,6 +2672,22 @@ bool is_downloading_state(int const st)
for (auto& p : peers)
add_peer(p, peer_info::dht);
#ifndef TORRENT_DISABLE_LOGGING
if (should_log())
{
error_code ec;
std::string str;
for (auto const& peer : peers)
{
str += peer.address().to_string(ec);
str += ' ';
}
debug_log("DHT add_peer() [ %s] connect-candidates: %d"
, str.c_str(), m_peer_list
? m_peer_list->num_connect_candidates() : -1);
}
#endif
do_connect_boost();
update_want_peers();
@ -3229,6 +3278,27 @@ bool is_downloading_state(int const st)
tcp::endpoint a(address_v6(i.ip), i.port);
need_update |= bool(add_peer(a, peer_info::tracker) != nullptr);
}
#ifndef TORRENT_DISABLE_LOGGING
if (should_log())
{
error_code ec;
std::string str;
for (auto const& peer : resp.peers4)
{
str += address_v4(peer.ip).to_string(ec);
str += ' ';
}
for (auto const& peer : resp.peers6)
{
str += address_v6(peer.ip).to_string(ec);
str += ' ';
}
debug_log("tracker add_peer() [ %s] connect-candidates: %d"
, str.c_str(), m_peer_list
? m_peer_list->num_connect_candidates() : -1);
}
#endif
if (need_update) state_updated();
update_want_peers();
@ -3444,6 +3514,16 @@ bool is_downloading_state(int const st)
if (add_peer(host, peer_info::tracker))
state_updated();
#ifndef TORRENT_DISABLE_LOGGING
if (should_log())
{
error_code ec;
debug_log("name-lookup add_peer() [ %s ] connect-candidates: %d"
, host.address().to_string(ec).c_str()
, m_peer_list ? m_peer_list->num_connect_candidates() : -1);
}
#endif
update_want_peers();
}
catch (...) { handle_exception(); }
@ -6907,16 +6987,13 @@ bool is_downloading_state(int const st)
++m_num_seeds;
}
#ifndef TORRENT_DISABLE_LOGGING
debug_log("incoming peer (%d)", num_peers());
#endif
#ifndef TORRENT_DISABLE_LOGGING
if (should_log()) try
{
debug_log("ATTACHED CONNECTION \"%s\" connections: %d limit: %d"
debug_log("ATTACHED CONNECTION \"%s\" connections: %d limit: %d num-peers: %d"
, print_endpoint(p->remote()).c_str(), num_peers()
, m_max_connections);
, m_max_connections
, num_peers());
}
catch (std::exception const&) {}
#endif
@ -7933,7 +8010,8 @@ bool is_downloading_state(int const st)
if (int(m_max_uploads)!= limit && state_update) state_updated();
m_max_uploads = aux::numeric_cast<std::uint32_t>(limit);
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** set-max-uploads: %d", m_max_uploads);
if (should_log() && state_update)
debug_log("*** set-max-uploads: %d", m_max_uploads);
#endif
if (state_update)
@ -7950,7 +8028,8 @@ bool is_downloading_state(int const st)
update_want_peers();
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** set-max-connections: %d", m_max_connections);
if (should_log() && state_update)
debug_log("*** set-max-connections: %d", m_max_connections);
#endif
if (num_peers() > int(m_max_connections))
@ -9979,15 +10058,6 @@ bool is_downloading_state(int const st)
torrent_peer* p = m_peer_list->add_peer(adr, source, flags, &st);
peers_erased(st.erased);
#ifndef TORRENT_DISABLE_LOGGING
if (should_log())
{
error_code ec;
debug_log("add_peer() %s connect-candidates: %d"
, adr.address().to_string(ec).c_str(), m_peer_list->num_connect_candidates());
}
#endif
if (p)
{
state_updated();

View File

@ -148,7 +148,7 @@ namespace libtorrent {
std::shared_ptr<request_callback> cb = requester();
if (cb && cb->should_log())
{
cb->debug_log(R"(*** UDP_TRACKER [ host: "%s" ip: "%s" | error: "%s" ])"
cb->debug_log(R"(*** UDP_TRACKER [ host: "%s" ip: "%s" | ERROR: "%s" ])"
, m_hostname.c_str(), print_endpoint(m_target).c_str(), ec.message().c_str());
}
#endif
@ -513,7 +513,7 @@ namespace libtorrent {
#ifndef TORRENT_DISABLE_LOGGING
if (cb && cb->should_log())
{
cb->debug_log("==> UDP_TRACKER_CONNECT [ to: %s ih: %s]"
cb->debug_log("==> UDP_TRACKER_CONNECT [ to: %s ih: %s ]"
, m_hostname.empty()
? print_endpoint(m_target).c_str()
: (m_hostname + ":" + to_string(m_target.port()).data()).c_str()