fix bug in DHT logging. clean up some whitespace

This commit is contained in:
Arvid Norberg 2015-05-17 02:00:43 +00:00
parent 58ae099cf8
commit c871610408
2 changed files with 60 additions and 55 deletions

View File

@ -1734,7 +1734,7 @@ namespace libtorrent {
};
char ret[900];
snprintf(ret, sizeof(ret), "%s: %s", dht_modules[module]
snprintf(ret, sizeof(ret), "DHT %s: %s", dht_modules[module]
, log_message());
return ret;
}

View File

@ -2505,7 +2505,7 @@ retry:
#ifndef TORRENT_DISABLE_LOGGING
session_log(" There are no torrents, disconnect");
#endif
return;
return;
}
// figure out which peer classes this is connections has,
@ -2568,7 +2568,7 @@ retry:
#ifndef TORRENT_DISABLE_LOGGING
session_log(" There are no _active_ torrents, disconnect");
#endif
return;
return;
}
}
@ -6494,7 +6494,7 @@ retry:
char buf[1024];
int offset = 0;
char const* prefix[] =
{ "<== ", "<== ERROR ", "==> ", "==> ERROR " };
{ "<== ", "==> ", "<== ERROR ", "==> ERROR " };
offset += snprintf(&buf[offset], sizeof(buf) - offset, prefix[dir]);
va_list v;
@ -6504,10 +6504,15 @@ retry:
bdecode_node print;
error_code ec;
int ret = bdecode(buf, buf + len, print, ec, NULL, 100, 100);
int ret = bdecode(pkt, pkt + len, print, ec, NULL, 100, 100);
// TODO: 3 there should be a separate dht_log_alert for messages that
// contains the raw packet separately. This printing should be moved
// down to the ::message() function of that alert
std::string msg = print_entry(print, true);
if (offset < sizeof(buf)) buf[offset++] = ' ';
strncpy(&buf[offset], msg.c_str(), sizeof(buf) - offset);
m_alerts.emplace_alert<dht_log_alert>(dht_log_alert::tracker, buf);
@ -6826,7 +6831,7 @@ retry:
}
for (std::vector<ipv4_peer_entry>::const_iterator i = resp.peers4.begin();
i != resp.peers4.end(); ++i)
{
{
debug_log(" %s:%d", print_address(address_v4(i->ip)).c_str(), i->port);
}
#if TORRENT_USE_IPV6