(trunk libT) minor procedural tweak to tr_peerMgrPeerStats() inspired by #3334

This commit is contained in:
Charles Kerr 2010-06-22 20:39:19 +00:00
parent 610c912c5a
commit 7e9ba59807
1 changed files with 5 additions and 4 deletions

View File

@ -2311,6 +2311,7 @@ tr_peerMgrPeerStats( const tr_torrent * tor,
const tr_peer ** peers; const tr_peer ** peers;
tr_peer_stat * ret; tr_peer_stat * ret;
uint64_t now; uint64_t now;
static const int CANCEL_HISTORY_MSEC = CANCEL_HISTORY_SEC * 1000;
assert( t->manager ); assert( t->manager );
managerLock( t->manager ); managerLock( t->manager );
@ -2345,10 +2346,10 @@ tr_peerMgrPeerStats( const tr_torrent * tor,
stat->isUploadingTo = clientIsUploadingTo( peer ); stat->isUploadingTo = clientIsUploadingTo( peer );
stat->isSeed = ( atom->uploadOnly == UPLOAD_ONLY_YES ) || ( peer->progress >= 1.0 ); stat->isSeed = ( atom->uploadOnly == UPLOAD_ONLY_YES ) || ( peer->progress >= 1.0 );
stat->blocksToPeer = tr_historyGet( peer->blocksSentToPeer, now, CANCEL_HISTORY_SEC*1000 ); stat->blocksToPeer = tr_historyGet( peer->blocksSentToPeer, now, CANCEL_HISTORY_MSEC );
stat->blocksToClient = tr_historyGet( peer->blocksSentToClient, now, CANCEL_HISTORY_SEC*1000 ); stat->blocksToClient = tr_historyGet( peer->blocksSentToClient, now, CANCEL_HISTORY_MSEC );
stat->cancelsToPeer = tr_historyGet( peer->cancelsSentToPeer, now, CANCEL_HISTORY_SEC*1000 ); stat->cancelsToPeer = tr_historyGet( peer->cancelsSentToPeer, now, CANCEL_HISTORY_MSEC );
stat->cancelsToClient = tr_historyGet( peer->cancelsSentToClient, now, CANCEL_HISTORY_SEC*1000 ); stat->cancelsToClient = tr_historyGet( peer->cancelsSentToClient, now, CANCEL_HISTORY_MSEC );
stat->pendingReqsToPeer = peer->pendingReqsToPeer; stat->pendingReqsToPeer = peer->pendingReqsToPeer;
stat->pendingReqsToClient = peer->pendingReqsToClient; stat->pendingReqsToClient = peer->pendingReqsToClient;