Changeset 1064
- Timestamp:
- Nov 10, 2006, 4:21:46 AM (16 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer.c
r1060 r1064 64 64 /* The pieces that the peer has */ 65 65 uint8_t * bitfield; 66 int pieceCount; 67 float progress; 66 68 67 69 int goodPcs; … … 536 538 537 539 /*********************************************************************** 540 * tr_peerIsDownloading 541 *********************************************************************** 542 * 543 **********************************************************************/ 544 float tr_peerProgress( tr_peer_t * peer ) 545 { 546 return peer->progress; 547 } 548 549 /*********************************************************************** 538 550 * tr_peerBitfield 539 551 *********************************************************************** -
trunk/libtransmission/peer.h
r1060 r1064 44 44 int tr_peerIsUploading ( tr_peer_t * ); 45 45 int tr_peerIsDownloading ( tr_peer_t * ); 46 float tr_peerProgress ( tr_peer_t * ); 46 47 uint8_t * tr_peerBitfield ( tr_peer_t * ); 47 48 float tr_peerDownloadRate ( tr_peer_t * ); -
trunk/libtransmission/peerparse.h
r931 r1064 107 107 peer->bitfield = calloc( ( tor->info.pieceCount + 7 ) / 8, 1 ); 108 108 } 109 if( !tr_bitfieldHas( peer->bitfield, piece ) ) 110 { 111 peer->pieceCount++; 112 peer->progress = (float) peer->pieceCount / tor->info.pieceCount; 113 } 109 114 tr_bitfieldAdd( peer->bitfield, piece ); 110 115 updateInterest( tor, peer ); … … 120 125 tr_info_t * inf = &tor->info; 121 126 int bitfieldSize; 127 int i; 122 128 123 129 bitfieldSize = ( inf->pieceCount + 7 ) / 8; … … 152 158 } 153 159 memcpy( peer->bitfield, p, bitfieldSize ); 160 161 peer->pieceCount = 0; 162 for( i = 0; i < inf->pieceCount; i++ ) 163 { 164 if( tr_bitfieldHas( peer->bitfield, i ) ) 165 { 166 peer->pieceCount++; 167 } 168 } 169 peer->progress = (float) peer->pieceCount / inf->pieceCount; 170 154 171 updateInterest( tor, peer ); 155 172 -
trunk/libtransmission/transmission.c
r1007 r1064 592 592 peers[i].isDownloading = tr_peerIsDownloading(peer); 593 593 peers[i].isUploading = tr_peerIsUploading(peer); 594 peers[i].progress = tr_peerProgress(peer); 594 595 } 595 596 } -
trunk/libtransmission/transmission.h
r1006 r1064 379 379 int isDownloading; 380 380 int isUploading; 381 float progress; 381 382 }; 382 383
Note: See TracChangeset
for help on using the changeset viewer.