mirror of
https://github.com/transmission/transmission
synced 2025-03-04 10:38:13 +00:00
split tr_stat_t's peersTotal into peersTotal and peersConnected
This commit is contained in:
parent
975e066919
commit
73ca83a455
5 changed files with 16 additions and 14 deletions
|
@ -260,7 +260,7 @@ int main( int argc, char ** argv )
|
|||
chars = snprintf( string, sizeof string,
|
||||
"Progress: %.2f %%, %d peer%s, dl from %d (%.2f KB/s), "
|
||||
"ul to %d (%.2f KB/s) [%s]", 100.0 * s->percentDone,
|
||||
s->peersTotal, ( s->peersTotal == 1 ) ? "" : "s",
|
||||
s->peersConnected, ( s->peersConnected == 1 ) ? "" : "s",
|
||||
s->peersUploading, s->rateDownload,
|
||||
s->peersDownloading, s->rateUpload,
|
||||
getStringRatio(s->ratio) );
|
||||
|
|
|
@ -213,8 +213,8 @@ tr_core_init( GTypeInstance * instance, gpointer g_class SHUTUP )
|
|||
G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_STRING, G_TYPE_INT,
|
||||
/* error, errorString, percentComplete, percentDone, rateDownload, rateUpload, */
|
||||
G_TYPE_INT, G_TYPE_STRING, G_TYPE_FLOAT, G_TYPE_FLOAT, G_TYPE_FLOAT, G_TYPE_FLOAT,
|
||||
/* eta, peersTotal, peersUploading, peersDownloading, seeders, */
|
||||
G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT,
|
||||
/* eta, peersConnected, peersUploading, peersDownloading, seeders, */
|
||||
G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT,
|
||||
/* leechers, completedFromTracker, downloaded, uploaded */
|
||||
G_TYPE_INT, G_TYPE_INT, G_TYPE_UINT64, G_TYPE_UINT64,
|
||||
/* left, tracker, TrTorrent object, ID for IPC */
|
||||
|
@ -610,7 +610,7 @@ tr_core_update( TrCore * self )
|
|||
MC_DRATE, st->rateDownload,
|
||||
MC_URATE, st->rateUpload,
|
||||
MC_ETA, st->eta,
|
||||
MC_PEERS, st->peersTotal,
|
||||
MC_PEERS, st->peersConnected,
|
||||
MC_UPEERS, st->peersUploading,
|
||||
MC_DPEERS, st->peersDownloading,
|
||||
MC_SEED, st->seeders,
|
||||
|
|
|
@ -604,7 +604,7 @@ tr_torrent_status_str ( TrTorrent * gtor )
|
|||
|
||||
const tr_stat_t * st = tr_torrent_stat( gtor );
|
||||
|
||||
const int tpeers = MAX (st->peersTotal, 0);
|
||||
const int tpeers = MAX (st->peersConnected, 0);
|
||||
const int upeers = MAX (st->peersUploading, 0);
|
||||
const int eta = st->eta;
|
||||
const double prog = st->percentDone * 100.0; /* [0...100] */
|
||||
|
|
|
@ -549,30 +549,31 @@ tr_stat_t * tr_torrentStat( tr_torrent_t * tor )
|
|||
|
||||
/* peers... */
|
||||
memset( s->peersFrom, 0, sizeof( s->peersFrom ) );
|
||||
s->peersTotal = 0;
|
||||
s->peersUploading = 0;
|
||||
s->peersDownloading = 0;
|
||||
s->peersTotal = tor->peerCount;
|
||||
s->peersConnected = 0;
|
||||
s->peersUploading = 0;
|
||||
s->peersDownloading = 0;
|
||||
|
||||
for( i=0; i<tor->peerCount; ++i )
|
||||
{
|
||||
const tr_peer_t * peer = tor->peers[i];
|
||||
++s->peersTotal;
|
||||
|
||||
if( tr_peerIsConnected( peer ) )
|
||||
{
|
||||
++s->peersConnected;
|
||||
++s->peersFrom[tr_peerIsFrom(peer)];
|
||||
|
||||
/*if( tr_peerIsInterested( peer ) && !tr_peerIsChokedByUs( peer ) )*/
|
||||
if( tr_peerDownloadRate( peer ) > 0.01 )
|
||||
++s->peersUploading;
|
||||
|
||||
/*if( tr_peerIsInteresting( peer ) && !tr_peerIsChokingUs( peer ) )*/
|
||||
if( tr_peerUploadRate( peer ) > 0.01 )
|
||||
++s->peersDownloading;
|
||||
}
|
||||
}
|
||||
|
||||
s->percentDone = tr_cpPercentDone( tor->completion );
|
||||
s->percentComplete = tr_cpPercentComplete( tor->completion );
|
||||
s->left = tr_cpLeftUntilDone( tor->completion );
|
||||
s->percentDone = tr_cpPercentDone ( tor->completion );
|
||||
s->percentComplete = tr_cpPercentComplete ( tor->completion );
|
||||
s->left = tr_cpLeftUntilDone ( tor->completion );
|
||||
|
||||
|
||||
if( tor->recheckFlag )
|
||||
|
|
|
@ -585,6 +585,7 @@ struct tr_stat_s
|
|||
float rateUpload;
|
||||
int eta;
|
||||
int peersTotal;
|
||||
int peersConnected;
|
||||
int peersFrom[TR_PEER_FROM__MAX];
|
||||
int peersUploading;
|
||||
int peersDownloading;
|
||||
|
|
Loading…
Add table
Reference in a new issue