forked from premiere/premiere-libtorrent
remove pointless DHT extension (for IPv6)
This commit is contained in:
parent
ba3ffe52f8
commit
0ed0bdc50c
|
@ -561,40 +561,18 @@ namespace detail
|
||||||
{
|
{
|
||||||
void TORRENT_EXTRA_EXPORT write_nodes_entry(entry& r, nodes_t const& nodes)
|
void TORRENT_EXTRA_EXPORT write_nodes_entry(entry& r, nodes_t const& nodes)
|
||||||
{
|
{
|
||||||
bool ipv6_nodes = false;
|
|
||||||
entry& n = r["nodes"];
|
entry& n = r["nodes"];
|
||||||
std::back_insert_iterator<std::string> out(n.string());
|
std::back_insert_iterator<std::string> out(n.string());
|
||||||
for (nodes_t::const_iterator i = nodes.begin()
|
for (nodes_t::const_iterator i = nodes.begin()
|
||||||
, end(nodes.end()); i != end; ++i)
|
, end(nodes.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
if (!i->addr().is_v4())
|
if (!i->addr().is_v4()) continue;
|
||||||
{
|
|
||||||
ipv6_nodes = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
std::copy(i->id.begin(), i->id.end(), out);
|
std::copy(i->id.begin(), i->id.end(), out);
|
||||||
write_endpoint(udp::endpoint(i->addr(), i->port()), out);
|
write_endpoint(udp::endpoint(i->addr(), i->port()), out);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ipv6_nodes)
|
|
||||||
{
|
|
||||||
entry& p = r["nodes2"];
|
|
||||||
std::string endpoint;
|
|
||||||
for (nodes_t::const_iterator i = nodes.begin()
|
|
||||||
, end(nodes.end()); i != end; ++i)
|
|
||||||
{
|
|
||||||
if (!i->addr().is_v6()) continue;
|
|
||||||
endpoint.resize(18 + 20);
|
|
||||||
std::string::iterator out = endpoint.begin();
|
|
||||||
std::copy(i->id.begin(), i->id.end(), out);
|
|
||||||
out += 20;
|
|
||||||
write_endpoint(udp::endpoint(i->addr(), i->port()), out);
|
|
||||||
endpoint.resize(out - endpoint.begin());
|
|
||||||
p.list().push_back(entry(endpoint));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
using detail::write_nodes_entry;
|
using detail::write_nodes_entry;
|
||||||
|
|
||||||
// verifies that a message has all the required
|
// verifies that a message has all the required
|
||||||
|
|
Loading…
Reference in New Issue