added session::is_dht_running

This commit is contained in:
Arvid Norberg
2009-10-24 21:55:16 +00:00
parent 042e8ad011
commit 65eb4db727
4 changed files with 15 additions and 2 deletions

View File

@@ -73,6 +73,7 @@
* added ability to give seeding torrents preference to active slots * added ability to give seeding torrents preference to active slots
* added torrent_status::finished_time * added torrent_status::finished_time
* automatically caps files and connections by default to rlimit * automatically caps files and connections by default to rlimit
* added session::is_dht_running() function
release 0.14.7 release 0.14.7

View File

@@ -213,6 +213,7 @@ The ``session`` class has the following synopsis::
, int> const& node); , int> const& node);
void add_dht_router(std::pair<std::string void add_dht_router(std::pair<std::string
, int> const& node); , int> const& node);
bool is_dht_running() const;
void start_lsd(); void start_lsd();
void stop_lsd(); void stop_lsd();
@@ -1064,8 +1065,8 @@ are ``hostname`` and ``port``.
.. _i2p: http://www.i2p2.de .. _i2p: http://www.i2p2.de
start_dht() stop_dht() set_dht_settings() dht_state() start_dht() stop_dht() set_dht_settings() dht_state() is_dht_running()
----------------------------------------------------- ----------------------------------------------------------------------
:: ::
@@ -1073,6 +1074,7 @@ start_dht() stop_dht() set_dht_settings() dht_state()
void stop_dht(); void stop_dht();
void set_dht_settings(dht_settings const& settings); void set_dht_settings(dht_settings const& settings);
entry dht_state() const; entry dht_state() const;
bool is_dht_running() const;
These functions are not available in case ``TORRENT_DISABLE_DHT`` is These functions are not available in case ``TORRENT_DISABLE_DHT`` is
defined. ``start_dht`` starts the dht node and makes the trackerless service defined. ``start_dht`` starts the dht node and makes the trackerless service
@@ -1133,6 +1135,9 @@ that are ready to replace a failing node, it will be replaced immediately,
this limit is only used to clear out nodes that don't have any node that can this limit is only used to clear out nodes that don't have any node that can
replace them. replace them.
``is_dht_running`` returns true if the DHT support has been started and false
otherwise.
add_dht_node() add_dht_router() add_dht_node() add_dht_router()
------------------------------- -------------------------------

View File

@@ -285,6 +285,7 @@ namespace libtorrent
entry dht_state() const; entry dht_state() const;
void add_dht_node(std::pair<std::string, int> const& node); void add_dht_node(std::pair<std::string, int> const& node);
void add_dht_router(std::pair<std::string, int> const& node); void add_dht_router(std::pair<std::string, int> const& node);
bool is_dht_running() const;
#endif #endif
#ifndef TORRENT_DISABLE_ENCRYPTION #ifndef TORRENT_DISABLE_ENCRYPTION

View File

@@ -618,6 +618,12 @@ namespace libtorrent
m_impl->add_dht_router(node); m_impl->add_dht_router(node);
} }
bool session::is_dht_running() const
{
mutex::scoped_lock l(m_impl->m_mutex);
return m_impl->m_dht;
}
#endif #endif
#ifndef TORRENT_DISABLE_ENCRYPTION #ifndef TORRENT_DISABLE_ENCRYPTION