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 ); return peer->peerChoking;
}
/***********************************************************************
* tr_peerIsDownloading
***********************************************************************
*
**********************************************************************/
int tr_peerIsDownloading( tr_peer_t * peer )
{
return peer->outBlockSending;
} }
/*********************************************************************** /***********************************************************************

View File

@ -43,8 +43,6 @@ uint8_t * tr_peerHash ( tr_peer_t * );
int tr_peerPulse ( tr_torrent_t * ); int tr_peerPulse ( tr_torrent_t * );
int tr_peerIsConnected ( tr_peer_t * ); int tr_peerIsConnected ( tr_peer_t * );
int tr_peerIsIncoming ( 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 * ); float tr_peerProgress ( tr_peer_t * );
int tr_peerPort ( tr_peer_t * ); int tr_peerPort ( tr_peer_t * );
uint8_t * tr_peerBitfield ( 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)++; (s->peersIncoming)++;
} }
if( !tr_peerIsChoking( peer ) )
if( tr_peerIsUploading( peer ) )
{ {
(s->peersUploading)++; (s->peersUploading)++;
} }
if( tr_peerIsDownloading( peer ) ) if( tr_peerIsUnchoked( peer ) )
{ {
(s->peersDownloading)++; (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].progress = tr_peerProgress( peer );
peers[i].port = tr_peerPort( 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 ); 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 ); peers[i].downloadFromRate = tr_peerDownloadRate( peer );
} }