forked from premiere/premiere-libtorrent
fix bug in DHT logging. clean up some whitespace
This commit is contained in:
parent
58ae099cf8
commit
c871610408
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue