1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +00:00

When we count the peers we are UL to, just check whether they are chocked

This commit is contained in:
Eric Petit 2007-01-19 05:15:22 +00:00
parent 7a6401c7b4
commit 7fc607cf2a
3 changed files with 7 additions and 20 deletions

View file

@ -522,23 +522,13 @@ int tr_peerIsIncoming( tr_peer_t * peer )
}
/***********************************************************************
* tr_peerIsUploading
* tr_peerIsChoking
***********************************************************************
*
**********************************************************************/
int tr_peerIsUploading( tr_peer_t * peer )
int tr_peerIsChoking( tr_peer_t * peer )
{
return ( peer->inRequestCount > 0 );
}
/***********************************************************************
* tr_peerIsDownloading
***********************************************************************
*
**********************************************************************/
int tr_peerIsDownloading( tr_peer_t * peer )
{
return peer->outBlockSending;
return peer->peerChoking;
}
/***********************************************************************

View file

@ -43,8 +43,6 @@ uint8_t * tr_peerHash ( tr_peer_t * );
int tr_peerPulse ( tr_torrent_t * );
int tr_peerIsConnected ( tr_peer_t * );
int tr_peerIsIncoming ( tr_peer_t * );
int tr_peerIsUploading ( tr_peer_t * );
int tr_peerIsDownloading ( tr_peer_t * );
float tr_peerProgress ( tr_peer_t * );
int tr_peerPort ( tr_peer_t * );
uint8_t * tr_peerBitfield ( tr_peer_t * );

View file

@ -436,12 +436,11 @@ tr_stat_t * tr_torrentStat( tr_torrent_t * tor )
{
(s->peersIncoming)++;
}
if( tr_peerIsUploading( peer ) )
if( !tr_peerIsChoking( peer ) )
{
(s->peersUploading)++;
}
if( tr_peerIsDownloading( peer ) )
if( tr_peerIsUnchoked( peer ) )
{
(s->peersDownloading)++;
}
@ -528,11 +527,11 @@ tr_peer_stat_t * tr_torrentPeers( tr_torrent_t * tor, int * peerCount )
peers[i].progress = tr_peerProgress( peer );
peers[i].port = tr_peerPort( peer );
if( ( peers[i].isDownloading = tr_peerIsDownloading( peer ) ) )
if( ( peers[i].isDownloading = tr_peerIsUnchoked( peer ) ) )
{
peers[i].uploadToRate = tr_peerUploadRate( peer );
}
if( ( peers[i].isUploading = tr_peerIsUploading( peer ) ) )
if( ( peers[i].isUploading = !tr_peerIsChoking( peer ) ) )
{
peers[i].downloadFromRate = tr_peerDownloadRate( peer );
}