forked from premiere/premiere-libtorrent
remove disable-dht build configuration from the public API (simplify linking)
This commit is contained in:
parent
4395437c3b
commit
df4fcaaeed
10
Jamfile
10
Jamfile
|
@ -365,9 +365,9 @@ feature.compose <logging>default : <define>TORRENT_LOGGING ;
|
|||
feature.compose <logging>errors : <define>TORRENT_ERROR_LOGGING ;
|
||||
feature.compose <logging>verbose : <define>TORRENT_VERBOSE_LOGGING ;
|
||||
|
||||
feature dht-support : on off logging : composite propagated link-incompatible ;
|
||||
feature.compose <dht-support>off : <define>TORRENT_DISABLE_DHT ;
|
||||
feature.compose <dht-support>logging : <define>TORRENT_DHT_VERBOSE_LOGGING ;
|
||||
feature dht : on off logging : composite propagated link-incompatible ;
|
||||
feature.compose <dht>off : <define>TORRENT_DISABLE_DHT ;
|
||||
feature.compose <dht>logging : <define>TORRENT_DHT_VERBOSE_LOGGING ;
|
||||
|
||||
feature encryption : tommath off openssl gcrypt : composite propagated link-incompatible ;
|
||||
feature.compose <encryption>openssl : <define>TORRENT_USE_OPENSSL ;
|
||||
|
@ -620,8 +620,8 @@ lib torrent
|
|||
<link>shared:<define>BOOST_ASIO_SOURCE
|
||||
<link>shared:<define>BOOST_SYSTEM_SOURCE
|
||||
|
||||
<dht-support>on:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
|
||||
<dht-support>logging:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
|
||||
<dht>on:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
|
||||
<dht>logging:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
|
||||
<conditional>@building
|
||||
<boost>system:<cxxflags>$(CXXFLAGS)
|
||||
|
||||
|
|
|
@ -254,7 +254,7 @@ Build features:
|
|||
| | * ``verbose`` - verbose peer wire logging. |
|
||||
| | * ``errors`` - like verbose, but limited to errors.|
|
||||
+--------------------------+----------------------------------------------------+
|
||||
| ``dht-support`` | * ``on`` - build with support for tracker less |
|
||||
| ``dht`` | * ``on`` - build with support for tracker less |
|
||||
| | torrents and DHT support. |
|
||||
| | * ``logging`` - build with DHT support and verbose |
|
||||
| | logging of the DHT protocol traffic. |
|
||||
|
|
|
@ -63,12 +63,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_CFG_IPV6 noipv_-
|
||||
#endif
|
||||
|
||||
#ifdef TORRENT_DISABLE_DHT
|
||||
#define TORRENT_CFG_DHT nodht_
|
||||
#else
|
||||
#define TORRENT_CFG_DHT dht_
|
||||
#endif
|
||||
|
||||
#ifdef TORRENT_DISABLE_POOL_ALLOCATORS
|
||||
#define TORRENT_CFG_POOL nopools_
|
||||
#else
|
||||
|
@ -105,8 +99,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
BOOST_PP_CAT(TORRENT_CFG_POOL, \
|
||||
BOOST_PP_CAT(TORRENT_CFG_LOG, \
|
||||
BOOST_PP_CAT(TORRENT_CFG_DEPR, \
|
||||
BOOST_PP_CAT(TORRENT_CFG_DHT, \
|
||||
TORRENT_CFG_EXT))))))
|
||||
TORRENT_CFG_EXT)))))
|
||||
|
||||
#define TORRENT_CFG_STRING BOOST_PP_STRINGIZE(TORRENT_CFG)
|
||||
|
||||
|
|
|
@ -264,10 +264,12 @@ namespace libtorrent
|
|||
void remove_feed(feed_handle h);
|
||||
void get_feeds(std::vector<feed_handle>& f) const;
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
void start_dht();
|
||||
void stop_dht();
|
||||
void set_dht_settings(dht_settings const& settings);
|
||||
void add_dht_node(std::pair<std::string, int> const& node);
|
||||
void add_dht_router(std::pair<std::string, int> const& node);
|
||||
bool is_dht_running() const;
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// deprecated in 0.15
|
||||
// use save_state and load_state instead
|
||||
|
@ -276,10 +278,6 @@ namespace libtorrent
|
|||
TORRENT_DEPRECATED_PREFIX
|
||||
void start_dht(entry const& startup_state) TORRENT_DEPRECATED;
|
||||
#endif
|
||||
void add_dht_node(std::pair<std::string, int> const& node);
|
||||
void add_dht_router(std::pair<std::string, int> const& node);
|
||||
bool is_dht_running() const;
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_DISABLE_ENCRYPTION
|
||||
void set_pe_settings(pe_settings const& settings);
|
||||
|
@ -408,12 +406,10 @@ namespace libtorrent
|
|||
TORRENT_DEPRECATED_PREFIX
|
||||
proxy_settings tracker_proxy() const TORRENT_DEPRECATED;
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
TORRENT_DEPRECATED_PREFIX
|
||||
void set_dht_proxy(proxy_settings const& s) TORRENT_DEPRECATED;
|
||||
TORRENT_DEPRECATED_PREFIX
|
||||
proxy_settings dht_proxy() const TORRENT_DEPRECATED;
|
||||
#endif
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
#if TORRENT_USE_I2P
|
||||
|
|
|
@ -286,11 +286,9 @@ namespace libtorrent
|
|||
// within this time, the peer is disconnected.
|
||||
int handshake_timeout;
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
// while this is true, the dht will not be used unless the
|
||||
// tracker is online
|
||||
bool use_dht_as_fallback;
|
||||
#endif
|
||||
|
||||
// if this is true, the piece hashes will be freed, in order
|
||||
// to save memory, once the torrent is seeding. This will
|
||||
|
@ -975,7 +973,6 @@ namespace libtorrent
|
|||
bool use_disk_cache_pool;
|
||||
};
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
struct dht_settings
|
||||
{
|
||||
dht_settings()
|
||||
|
@ -1044,7 +1041,6 @@ namespace libtorrent
|
|||
// outstanding requests
|
||||
bool aggressive_lookups;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_DISABLE_ENCRYPTION
|
||||
|
||||
|
|
|
@ -40,8 +40,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
namespace libtorrent
|
||||
{
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
|
||||
struct dht_lookup
|
||||
{
|
||||
char const* type;
|
||||
|
@ -70,8 +68,6 @@ namespace libtorrent
|
|||
int last_active;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
struct utp_status
|
||||
{
|
||||
int num_idle;
|
||||
|
@ -129,7 +125,6 @@ namespace libtorrent
|
|||
int disk_write_queue;
|
||||
int disk_read_queue;
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
int dht_nodes;
|
||||
int dht_node_cache;
|
||||
int dht_torrents;
|
||||
|
@ -137,7 +132,6 @@ namespace libtorrent
|
|||
std::vector<dht_lookup> active_requests;
|
||||
std::vector<dht_routing_bucket> dht_routing_table;
|
||||
int dht_total_allocations;
|
||||
#endif
|
||||
|
||||
utp_status utp_stats;
|
||||
|
||||
|
|
|
@ -366,10 +366,8 @@ namespace libtorrent
|
|||
// forces this torrent to reannounce
|
||||
// (make a rerequest from the tracker)
|
||||
void force_reannounce() const;
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
// announces this torrent to the DHT immediately
|
||||
void force_dht_announce() const;
|
||||
#endif
|
||||
|
||||
// forces a reannounce in the specified amount of time.
|
||||
// This overrides the default announce interval, and no
|
||||
|
|
|
@ -786,54 +786,70 @@ namespace libtorrent
|
|||
return m_impl->m_disk_thread.status();
|
||||
}
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
|
||||
void session::start_dht()
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
// the state is loaded in load_state()
|
||||
TORRENT_ASYNC_CALL(start_dht);
|
||||
#endif
|
||||
}
|
||||
|
||||
void session::stop_dht()
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
TORRENT_ASYNC_CALL(stop_dht);
|
||||
#endif
|
||||
}
|
||||
|
||||
void session::set_dht_settings(dht_settings const& settings)
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
TORRENT_ASYNC_CALL1(set_dht_settings, settings);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
void session::start_dht(entry const& startup_state)
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
TORRENT_ASYNC_CALL1(start_dht, startup_state);
|
||||
#endif
|
||||
}
|
||||
|
||||
entry session::dht_state() const
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
TORRENT_SYNC_CALL_RET(entry, dht_state);
|
||||
return r;
|
||||
}
|
||||
#else
|
||||
return entry();
|
||||
#endif
|
||||
}
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
void session::add_dht_node(std::pair<std::string, int> const& node)
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
TORRENT_ASYNC_CALL1(add_dht_node_name, node);
|
||||
#endif
|
||||
}
|
||||
|
||||
void session::add_dht_router(std::pair<std::string, int> const& node)
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
TORRENT_ASYNC_CALL1(add_dht_router, node);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool session::is_dht_running() const
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
TORRENT_SYNC_CALL_RET(bool, is_dht_running);
|
||||
return r;
|
||||
}
|
||||
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef TORRENT_DISABLE_ENCRYPTION
|
||||
void session::set_pe_settings(pe_settings const& settings)
|
||||
|
@ -911,18 +927,22 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
void session::set_dht_proxy(proxy_settings const& s)
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
TORRENT_ASYNC_CALL1(set_dht_proxy, s);
|
||||
#endif
|
||||
}
|
||||
|
||||
proxy_settings session::dht_proxy() const
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
TORRENT_SYNC_CALL_RET(proxy_settings, dht_proxy);
|
||||
return r;
|
||||
}
|
||||
#else
|
||||
return proxy_settings();
|
||||
#endif
|
||||
}
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
#if TORRENT_USE_I2P
|
||||
|
@ -1165,9 +1185,7 @@ namespace libtorrent
|
|||
, max_queued_disk_bytes(1024 * 1024)
|
||||
, max_queued_disk_bytes_low_watermark(0)
|
||||
, handshake_timeout(10)
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
, use_dht_as_fallback(false)
|
||||
#endif
|
||||
, free_torrent_hashes(true)
|
||||
, upnp_ignore_nonrouters(false)
|
||||
, send_buffer_low_watermark(512)
|
||||
|
|
|
@ -5558,7 +5558,12 @@ retry:
|
|||
s.total_dht_download = m_stat.total_transfer(stat::download_dht_protocol);
|
||||
s.dht_upload_rate = m_stat.transfer_rate(stat::upload_dht_protocol);
|
||||
s.total_dht_upload = m_stat.total_transfer(stat::upload_dht_protocol);
|
||||
#endif
|
||||
#else
|
||||
s.dht_download_rate = 0;
|
||||
s.total_dht_download = 0;
|
||||
s.dht_upload_rate = 0;
|
||||
s.total_dht_upload = 0;
|
||||
#endif // TORRENT_DISABLE_DHT
|
||||
|
||||
// tracker
|
||||
s.tracker_download_rate = m_stat.transfer_rate(stat::download_tracker_protocol);
|
||||
|
@ -5591,6 +5596,7 @@ retry:
|
|||
m_dht->dht_status(s);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
s.dht_nodes = 0;
|
||||
s.dht_node_cache = 0;
|
||||
|
@ -5598,7 +5604,6 @@ retry:
|
|||
s.dht_global_nodes = 0;
|
||||
s.dht_total_allocations = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_utp_socket_manager.get_status(s.utp_stats);
|
||||
|
||||
|
|
|
@ -905,13 +905,13 @@ namespace libtorrent
|
|||
TORRENT_ASYNC_CALL1(force_tracker_request, time_now() + seconds(duration.total_seconds()));
|
||||
}
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
void torrent_handle::force_dht_announce() const
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
TORRENT_ASYNC_CALL(dht_announce);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void torrent_handle::force_reannounce() const
|
||||
{
|
||||
|
|
|
@ -69,11 +69,14 @@ using namespace boost::tuples;
|
|||
|
||||
namespace libtorrent {
|
||||
TORRENT_EXPORT std::string sanitize_path(std::string const& p);
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
namespace dht
|
||||
{
|
||||
TORRENT_EXPORT libtorrent::dht::node_id generate_id_impl(
|
||||
address const& ip_, boost::uint32_t r);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
sha1_hash to_hash(char const* s)
|
||||
|
@ -451,6 +454,7 @@ int test_main()
|
|||
TEST_CHECK(ret == 1);
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
// test verify_message
|
||||
const static key_desc_t msg_desc[] = {
|
||||
{"A", lazy_entry::string_t, 4, 0},
|
||||
|
@ -543,6 +547,7 @@ int test_main()
|
|||
TEST_CHECK(ent.list_at(1)->string_value() == "");
|
||||
}
|
||||
}
|
||||
#endif // TORRENT_DISABLE_DHT
|
||||
|
||||
// test external ip voting
|
||||
external_ip ipv1;
|
||||
|
@ -896,6 +901,7 @@ int test_main()
|
|||
TEST_CHECK(ec == error_code(errors::missing_info_hash_in_uri));
|
||||
ec.clear();
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
parse_magnet_uri("magnet:?xt=urn:btih:cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd&dn=foo&dht=127.0.0.1:43", p, ec);
|
||||
TEST_CHECK(!ec);
|
||||
if (ec) fprintf(stderr, "%s\n", ec.message().c_str());
|
||||
|
@ -904,6 +910,7 @@ int test_main()
|
|||
TEST_CHECK(p.dht_nodes.size() == 1);
|
||||
TEST_CHECK(p.dht_nodes[0].first == "127.0.0.1");
|
||||
TEST_CHECK(p.dht_nodes[0].second == 43);
|
||||
#endif
|
||||
|
||||
// make sure settings that haven't been changed from their defaults are not saved
|
||||
TEST_CHECK(session_state2.dict_find("settings")->dict_find("optimistic_disk_retry") == 0);
|
||||
|
|
Loading…
Reference in New Issue