added feature to turn off making outgoing connections for seeds

This commit is contained in:
Arvid Norberg 2010-12-17 03:20:36 +00:00
parent 0b213d95d2
commit f2416af718
5 changed files with 26 additions and 1 deletions

View File

@ -133,6 +133,11 @@ void bind_session_settings()
.def_readwrite("tick_interval", &session_settings::tick_interval)
.def_readwrite("report_web_seed_downloads", &session_settings::report_web_seed_downloads)
.def_readwrite("share_mode_target", &session_settings::share_mode_target)
.def_readwrite("rate_limit_utp", &session_settings::rate_limit_utp)
.def_readwrite("listen_queue_size", &session_settings::listen_queue_size)
.def_readwrite("announce_double_nat", &session_settings::announce_double_nat)
.def_readwrite("torrent_connect_boost", &session_settings::torrent_connect_boost)
.def_readwrite("seeding_outgoing_connections", &session_settings::seeding_outgoing_connections)
;
enum_<proxy_settings::proxy_type>("proxy_type")

View File

@ -4010,6 +4010,7 @@ session_settings
bool announce_double_nat;
int torrent_connect_boost;
bool seeding_outgoing_connections;
};
``version`` is automatically set to the libtorrent version you're using
@ -4818,6 +4819,13 @@ given to new torrents to accelerate them starting up. The normal connect schedul
is run once every second, this allows peers to be connected immediately instead
of waiting for the session tick to trigger connections.
``seeding_outgoing_connections`` determines if seeding (and finished) torrents
should attempt to make outgoing connections or not. By default this is true. It
may be set to false in very specific applications where the cost of making
outgoing connections is high, and there are no or small benefits of doing so.
For instance, if no nodes are behind a firewall or a NAT, seeds don't need to
make outgoing connections.
pe_settings
===========

View File

@ -253,6 +253,7 @@ namespace libtorrent
, listen_queue_size(5)
, announce_double_nat(false)
, torrent_connect_boost(10)
, seeding_outgoing_connections(true)
{}
// libtorrent version. Used for forward binary compatibility
@ -1006,6 +1007,13 @@ namespace libtorrent
// instead of waiting for the connection scheduler which
// triggeres every second
int torrent_connect_boost;
// this controls whether or not seeding (and complete) torrents
// attempt to make outgoing connections or not. It defaults to
// true, but can be set to zero for specific applications where
// making outgoing connections is costly and known to not
// add any benefits
bool seeding_outgoing_connections;
};
#ifndef TORRENT_DISABLE_DHT

View File

@ -347,6 +347,7 @@ namespace aux {
TORRENT_SETTING(integer, listen_queue_size)
TORRENT_SETTING(boolean, announce_double_nat)
TORRENT_SETTING(integer, torrent_connect_boost)
TORRENT_SETTING(boolean, seeding_outgoing_connections)
};
#undef TORRENT_SETTING

View File

@ -4752,7 +4752,10 @@ namespace libtorrent
&& m_state != torrent_status::queued_for_checking)
|| !valid_metadata())
&& m_policy.num_connect_candidates() > 0
&& !m_abort;
&& !m_abort
&& (m_ses.settings().seeding_outgoing_connections
|| m_state != torrent_status::seeding
|| m_state != torrent_status::finished);
}
void torrent::disconnect_all(error_code const& ec)