Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KTorrent
Commits
60dd0cf7
Commit
60dd0cf7
authored
May 11, 2009
by
Joris Guisson
Browse files
Tweak choke algorithm a bit and remove unused evil flag
svn path=/trunk/extragear/network/ktorrent/; revision=966376
parent
aae0ab35
Changes
3
Hide whitespace changes
Inline
Side-by-side
libbtcore/interfaces/peerinterface.h
View file @
60dd0cf7
...
...
@@ -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
...
...
libbtcore/peer/peer.cpp
View file @
60dd0cf7
...
...
@@ -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
);
...
...
libbtcore/torrent/advancedchokealgorithm.cpp
View file @
60dd0cf7
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment