fixed parole mode with timeouts and made it optional

This commit is contained in:
Arvid Norberg 2008-07-11 09:23:22 +00:00
parent de8f676b98
commit 589e098002
3 changed files with 19 additions and 1 deletions

View File

@ -2835,6 +2835,7 @@ that will be sent to the tracker. The user-agent is a good way to identify your
bool upnp_ignore_nonrouters;
int send_buffer_watermark;
bool auto_upload_slots;
bool use_parole_mode;
int cache_size;
int cache_expiry;
std::pair<int, int> outgoing_ports;
@ -3037,6 +3038,12 @@ of time, on upload slot is closed. The number of upload slots will never be
less than what has been set by ``session::set_max_uploads()``. To query the
current number of upload slots, see ``session_status::allowed_upload_slots``.
``use_parole_mode`` specifies if parole mode should be used. Parole mode means
that peers that participate in pieces that fail the hash check are put in a mode
where they are only allowed to download whole pieces. If the whole piece a peer
in parole mode fails the hash check, it is banned. If a peer participates in a
piece that passes the hash check, it is taken out of parole mode.
``cache_size`` is the disk write cache. It is specified in units of 16 KiB blocks.
It defaults to 512 (= 8 MB).

View File

@ -121,6 +121,7 @@ namespace libtorrent
, upnp_ignore_nonrouters(true)
, send_buffer_watermark(80 * 1024)
, auto_upload_slots(true)
, use_parole_mode(true)
, cache_size(512)
, cache_expiry(60)
, outgoing_ports(0,0)
@ -342,6 +343,13 @@ namespace libtorrent
// the manual settings, through max_uploads.
bool auto_upload_slots;
// if set to true, peers that participate in a failing
// piece is put in parole mode. i.e. They will only
// download whole pieces until they either fail or pass.
// they are taken out of parole mode as soon as they
// participate in a piece that passes.
bool use_parole_mode;
// the disk write cache, specified in 16 KiB blocks.
// default is 512 (= 8 MB)
int cache_size;

View File

@ -632,7 +632,9 @@ namespace libtorrent
if (peer_info_struct())
{
peer_info_struct()->on_parole = true;
if (m_ses.settings().use_parole_mode)
peer_info_struct()->on_parole = true;
++peer_info_struct()->hashfails;
boost::int8_t& trust_points = peer_info_struct()->trust_points;
@ -2813,6 +2815,7 @@ namespace libtorrent
}
m_desired_queue_size = 1;
if (on_parole()) return;
if (!t->has_picker()) return;
piece_picker& picker = t->picker();