support dht nodes in magnet links
This commit is contained in:
@@ -3678,8 +3678,7 @@ namespace aux {
|
||||
|
||||
void session_impl::add_dht_node_name(std::pair<std::string, int> const& node)
|
||||
{
|
||||
TORRENT_ASSERT(m_dht);
|
||||
m_dht->add_node(node);
|
||||
if (m_dht) m_dht->add_node(node);
|
||||
}
|
||||
|
||||
void session_impl::add_dht_router(std::pair<std::string, int> const& node)
|
||||
@@ -3694,11 +3693,16 @@ namespace aux {
|
||||
void session_impl::on_dht_router_name_lookup(error_code const& e
|
||||
, tcp::resolver::iterator host)
|
||||
{
|
||||
if (e || host == tcp::resolver::iterator()) return;
|
||||
// router nodes should be added before the DHT is started (and bootstrapped)
|
||||
udp::endpoint ep(host->endpoint().address(), host->endpoint().port());
|
||||
if (m_dht) m_dht->add_router_node(ep);
|
||||
m_dht_router_nodes.push_back(ep);
|
||||
// TODO: report errors as alerts
|
||||
if (e) return;
|
||||
while (host != tcp::resolver::iterator())
|
||||
{
|
||||
// router nodes should be added before the DHT is started (and bootstrapped)
|
||||
udp::endpoint ep(host->endpoint().address(), host->endpoint().port());
|
||||
if (m_dht) m_dht->add_router_node(ep);
|
||||
m_dht_router_nodes.push_back(ep);
|
||||
++host;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user