back-port ut_pex fixes

This commit is contained in:
arvidn 2019-12-03 12:45:13 +01:00 committed by Arvid Norberg
parent b329d579e9
commit b5e717ffe0
1 changed files with 8 additions and 10 deletions

View File

@ -350,12 +350,12 @@ namespace libtorrent { namespace {
}
}
bdecode_node p6 = pex_msg.dict_find("dropped6");
#ifndef TORRENT_DISABLE_LOGGING
if (p6) num_dropped += p6.string_length() / 18;
#endif
if (p6.type() == bdecode_node::string_t)
bdecode_node p6 = pex_msg.dict_find_string("dropped6");
if (p6)
{
#ifndef TORRENT_DISABLE_LOGGING
num_dropped += p6.string_length() / 18;
#endif
int const num_peers = p6.string_length() / 18;
char const* in = p6.string_ptr();
@ -368,14 +368,12 @@ namespace libtorrent { namespace {
}
}
p6 = pex_msg.dict_find("added6");
p6 = pex_msg.dict_find_string("added6");
#ifndef TORRENT_DISABLE_LOGGING
if (p6) num_added += p6.string_length() / 18;
#endif
bdecode_node const p6f = pex_msg.dict_find("added6.f");
if (p6.type() == bdecode_node::string_t
&& p6f.type() == bdecode_node::string_t
&& p6f.string_length() == p6.string_length() / 18)
bdecode_node const p6f = pex_msg.dict_find_string("added6.f");
if (p6 && p6f && p6f.string_length() == p6.string_length() / 18)
{
int const num_peers = p6f.string_length();
char const* in = p6.string_ptr();