fix minor robustness issue in DHT bootstrap logic
This commit is contained in:
parent
f95f5b05c2
commit
4d397f5ebf
|
@ -1,3 +1,4 @@
|
||||||
|
* fix minor robustness issue in DHT bootstrap logic
|
||||||
* fix issue where torrent_status::num_seeds could be negative
|
* fix issue where torrent_status::num_seeds could be negative
|
||||||
* document deprecation of dynamic loading/unloading of torrents
|
* document deprecation of dynamic loading/unloading of torrents
|
||||||
* include user-agent in tracker announces in anonymous_mode for private torrents
|
* include user-agent in tracker announces in anonymous_mode for private torrents
|
||||||
|
|
|
@ -55,8 +55,6 @@ public:
|
||||||
observer_ptr new_observer(void* ptr, udp::endpoint const& ep
|
observer_ptr new_observer(void* ptr, udp::endpoint const& ep
|
||||||
, node_id const& id);
|
, node_id const& id);
|
||||||
|
|
||||||
void trim_seed_nodes();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual bool invoke(observer_ptr o);
|
virtual bool invoke(observer_ptr o);
|
||||||
|
|
|
@ -218,9 +218,6 @@ void node::bootstrap(std::vector<udp::endpoint> const& nodes
|
||||||
r->add_entry(node_id(0), *i, observer::flag_initial);
|
r->add_entry(node_id(0), *i, observer::flag_initial);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make us start as far away from our node ID as possible
|
|
||||||
r->trim_seed_nodes();
|
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
if (m_observer)
|
if (m_observer)
|
||||||
m_observer->log(dht_logger::node, "bootstrapping with %d nodes", count);
|
m_observer->log(dht_logger::node, "bootstrapping with %d nodes", count);
|
||||||
|
|
|
@ -89,15 +89,6 @@ bootstrap::bootstrap(
|
||||||
|
|
||||||
char const* bootstrap::name() const { return "bootstrap"; }
|
char const* bootstrap::name() const { return "bootstrap"; }
|
||||||
|
|
||||||
void bootstrap::trim_seed_nodes()
|
|
||||||
{
|
|
||||||
// when we're bootstrapping, we want to start as far away from our ID as
|
|
||||||
// possible, to cover as much as possible of the ID space. So, remove all
|
|
||||||
// nodes except for the 32 that are farthest away from us
|
|
||||||
if (m_results.size() > 32)
|
|
||||||
m_results.erase(m_results.begin(), m_results.end() - 32);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bootstrap::done()
|
void bootstrap::done()
|
||||||
{
|
{
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
|
|
Loading…
Reference in New Issue