made inactivity time-out configurable

This commit is contained in:
Arvid Norberg 2007-05-31 19:57:15 +00:00
parent 43a28e7a49
commit 7e540a8d53
3 changed files with 36 additions and 3 deletions

View File

@ -2180,6 +2180,11 @@ that will be sent to the tracker. The user-agent is a good way to identify your
int max_failcount;
int min_reconnect_time;
int peer_connect_timeout;
bool ignore_limits_on_local_network;
int connection_speed;
int send_redundant_have;
bool lazy_bitfields;
int inactivity_timeout;
bool use_dht_as_fallback;
};
@ -2280,6 +2285,26 @@ The default is 10 seconds. This setting is especially important in case
the number of half-open connections are limited, since stale half-open
connection may delay the connection of other peers considerably.
``ignore_limits_on_local_network``, if set to true, upload, download and
unchoke limits are ignored for peers on the local network.
``connection_speed`` is the number of connection attempts that
are made per second.
``send_redundant_have`` controls if have messages will be sent
to peers that already have the piece. This is typically not necessary,
but it might be necessary for collecting statistics in some cases.
Default is false.
``lazy_bitfields`` prevents outgoing bitfields from being full. If the
client is seed, a few bits will be set to 0, and later filled in with
have-messages. This is to prevent certain ISPs from stopping people
from seeding.
``inactivity_timeout``, if a peer is uninteresting and uninterested
for longer than this number of seconds, it will be disconnected.
Default is 10 minutes
``use_dht_as_fallback`` determines how the DHT is used. If this is true
(which it is by default), the DHT will only be used for torrents where
all trackers in its tracker list has failed. Either by an explicit error

View File

@ -104,6 +104,7 @@ namespace libtorrent
, connection_speed(20)
, send_redundant_have(false)
, lazy_bitfields(true)
, inactivity_timeout(600)
#ifndef TORRENT_DISABLE_DHT
, use_dht_as_fallback(true)
#endif
@ -228,6 +229,11 @@ namespace libtorrent
// from stopping people from seeding.
bool lazy_bitfields;
// if a peer is uninteresting and uninterested for longer
// than this number of seconds, it will be disconnected.
// default is 10 minutes
int inactivity_timeout;
#ifndef TORRENT_DISABLE_DHT
// while this is true, the dht will note be used unless the
// tracker is online

View File

@ -2592,11 +2592,13 @@ namespace libtorrent
time_duration d2;
d1 = now - m_became_uninterested;
d2 = now - m_became_uninteresting;
// TODO: these timeouts should be user settable
time_duration time_limit = seconds(
m_ses.settings().inactivity_timeout);
if (!m_interesting
&& !m_peer_interested
&& d1 > minutes(10)
&& d2 > minutes(10))
&& d1 > time_limit
&& d2 > time_limit)
{
return true;
}