IPv6 only tracker fix

This commit is contained in:
Arvid Norberg 2009-03-22 22:24:11 +00:00
parent 643be6c44b
commit 37cbdb331e
2 changed files with 16 additions and 10 deletions

View File

@ -49,6 +49,8 @@ release 0.14.3
* fixed missing include in enum_if.cpp
* fixed dual IP stack issue
* fixed issue where renamed files were sometimes not saved in resume data
* accepts tracker responses with no 'peers' field, as long as 'peers6'
is present
release 0.14.2

View File

@ -393,13 +393,7 @@ namespace libtorrent
}
entry const* peers_ent = e.find_key("peers");
if (peers_ent == 0)
{
fail(-1, "missing 'peers' entry in tracker response");
return;
}
if (peers_ent->type() == entry::string_t)
if (peers_ent && peers_ent->type() == entry::string_t)
{
std::string const& peers = peers_ent->string();
for (std::string::const_iterator i = peers.begin();
@ -416,7 +410,7 @@ namespace libtorrent
peer_list.push_back(p);
}
}
else if (peers_ent->type() == entry::list_t)
else if (peers_ent && peers_ent->type() == entry::list_t)
{
entry::list_type const& l = peers_ent->list();
for(entry::list_type::const_iterator i = l.begin(); i != l.end(); ++i)
@ -428,8 +422,7 @@ namespace libtorrent
}
else
{
fail(-1, "invalid 'peers' entry in tracker response");
return;
peers_ent = 0;
}
entry const* ipv6_peers = e.find_key("peers6");
@ -450,6 +443,17 @@ namespace libtorrent
peer_list.push_back(p);
}
}
else
{
ipv6_peers = 0;
}
if (peers_ent == 0 && ipv6_peers == 0)
{
fail(-1, "missing 'peers' and 'peers6' entry in tracker response");
return;
}
// look for optional scrape info
int complete = -1;