mirror of
https://github.com/transmission/transmission
synced 2024-12-24 16:52:39 +00:00
(libT) fix r7109 oops spotted by BentMyWookie
This commit is contained in:
parent
930b94a4de
commit
d42fae7dce
1 changed files with 10 additions and 9 deletions
|
@ -1842,7 +1842,8 @@ struct ChokeData
|
||||||
{
|
{
|
||||||
unsigned int doUnchoke : 1;
|
unsigned int doUnchoke : 1;
|
||||||
unsigned int isInterested : 1;
|
unsigned int isInterested : 1;
|
||||||
double rate;
|
unsigned int isChoked : 1;
|
||||||
|
int rate;
|
||||||
tr_peer * peer;
|
tr_peer * peer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1852,15 +1853,14 @@ compareChoke( const void * va,
|
||||||
{
|
{
|
||||||
const struct ChokeData * a = va;
|
const struct ChokeData * a = va;
|
||||||
const struct ChokeData * b = vb;
|
const struct ChokeData * b = vb;
|
||||||
int diff = 0;
|
|
||||||
|
|
||||||
if( diff == 0 ) /* prefer higher overall speeds */
|
if( a->rate != b->rate ) /* prefer higher overall speeds */
|
||||||
diff = a->rate > b->rate ? -1 : 1;
|
return a->rate > b->rate ? -1 : 1;
|
||||||
|
|
||||||
if( diff == 0 ) /* prefer unchoked */
|
if( a->isChoked != b->isChoked ) /* prefer unchoked */
|
||||||
diff = (int)a->peer->peerIsChoked - (int)b->peer->peerIsChoked;
|
return a->isChoked ? 1 : -1;
|
||||||
|
|
||||||
return diff;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1901,8 +1901,9 @@ rechoke( Torrent * t )
|
||||||
struct ChokeData * n = &choke[size++];
|
struct ChokeData * n = &choke[size++];
|
||||||
n->peer = peer;
|
n->peer = peer;
|
||||||
n->isInterested = peer->peerIsInterested;
|
n->isInterested = peer->peerIsInterested;
|
||||||
n->rate = tr_peerGetPieceSpeed( peer, TR_CLIENT_TO_PEER )
|
n->isChoked = peer->peerIsChoked;
|
||||||
+ tr_peerGetPieceSpeed( peer, TR_PEER_TO_CLIENT );
|
n->rate = (int)(tr_peerGetPieceSpeed( peer, TR_CLIENT_TO_PEER )
|
||||||
|
+ tr_peerGetPieceSpeed( peer, TR_PEER_TO_CLIENT ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue