Commit 60dd0cf7 authored by Joris Guisson's avatar Joris Guisson
Browse files

Tweak choke algorithm a bit and remove unused evil flag

svn path=/trunk/extragear/network/ktorrent/; revision=966376
parent aae0ab35
......@@ -63,9 +63,6 @@ namespace bt
bt::Uint64 bytes_downloaded;
/// Advanced choke algorithm score
double aca_score;
/// The evil flag is on when the peer has not choked us,
/// but has snubbed us and requests have timedout
bool evil;
/// Flag to indicate if this peer has an upload slot
bool has_upload_slot;
/// Is the peer interested
......
......@@ -85,7 +85,6 @@ namespace bt
stats.extension_protocol = support & EXT_PROT_SUPPORT;
stats.bytes_downloaded = stats.bytes_uploaded = 0;
stats.aca_score = 0.0;
stats.evil = false;
stats.has_upload_slot = false;
stats.num_up_requests = stats.num_down_requests = 0;
stats.encrypted = sock->encrypted();
......@@ -259,9 +258,6 @@ namespace bt
{
stats.bytes_downloaded += (len - 9);
// turn on evil bit
if (stats.evil)
stats.evil = false;
Piece p(ReadUint32(tmp_buf,1),
ReadUint32(tmp_buf,5),
len - 9,downloader,tmp_buf+9);
......
......@@ -89,7 +89,7 @@ namespace bt
double nb = 0.0; // newbie bonus
double cp = 0.0; // choke penalty
double sp = 0.0; // snubbing penalty
double sp = s.snubbed ? SNUB_PENALTY : 0.0; // snubbing penalty
double lb = s.local ? 10.0 : 0.0; // local peers get a bonus of 10
double bd = s.bytes_downloaded; // bytes downloaded
double tbd = stats.session_bytes_downloaded; // total bytes downloaded
......@@ -107,12 +107,6 @@ namespace bt
cp = NEWBIE_BONUS; // cp cancels out newbie bonus
}
// if the evil bit is on (!choked, snubbed and requests have timed out)
if (s.evil)
{
sp = SNUB_PENALTY;
}
// NB + K * (BD/TBD) - CP - SP + L * (DS / TDS)
double K = 5.0;
double L = 5.0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment