fixed race when adding router nodes to the dht (router nodes should be added before it's started)

This commit is contained in:
Arvid Norberg
2008-09-02 06:37:40 +00:00
parent 0074b10b88
commit c88071ae10
7 changed files with 48 additions and 36 deletions

View File

@@ -549,6 +549,10 @@ namespace libtorrent
udp_socket m_dht_socket;
// these are used when starting the DHT
// (and bootstrapping it), and then erased
std::list<std::pair<std::string, int> > m_dht_router_nodes;
void on_receive_udp(error_code const& e
, udp::endpoint const& ep, char const* buf, int len);
#endif

View File

@@ -71,8 +71,9 @@ namespace libtorrent { namespace dht
{
friend void intrusive_ptr_add_ref(dht_tracker const*);
friend void intrusive_ptr_release(dht_tracker const*);
dht_tracker(udp_socket& sock, dht_settings const& settings
, entry const& bootstrap);
dht_tracker(udp_socket& sock, dht_settings const& settings);
void start(entry const& bootstrap);
void stop();
void add_node(udp::endpoint node);

View File

@@ -161,7 +161,7 @@ class node_impl : boost::noncopyable
typedef std::map<node_id, torrent_entry> table_t;
public:
node_impl(boost::function<void(msg const&)> const& f
, dht_settings const& settings, boost::optional<node_id> node_id);
, dht_settings const& settings);
virtual ~node_impl() {}
@@ -186,7 +186,9 @@ public:
typedef table_t::iterator data_iterator;
void set_node_id(node_id const& nid) { m_id = nid; }
node_id const& nid() const { return m_id; }
boost::tuple<int, int> size() const{ return m_table.size(); }
size_type num_global_nodes() const
{ return m_table.num_global_nodes(); }