Changeset 140
- Timestamp:
- Mar 9, 2006, 2:32:16 AM (17 years ago)
- Location:
- branches/new_api/libtransmission
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_api/libtransmission/transmission.c
r139 r140 348 348 tr_stat_t * s; 349 349 tr_info_t * inf = &tor->info; 350 int i , j, piece;350 int i; 351 351 352 352 tor->statCur = ( tor->statCur + 1 ) % 2; … … 415 415 } 416 416 417 for( i = 0; i < 120; i++ ) 418 { 419 piece = i * inf->pieceCount / 120; 417 s->downloaded = tor->downloaded; 418 s->uploaded = tor->uploaded; 419 420 tr_lockUnlock( &tor->lock ); 421 422 return s; 423 } 424 425 void tr_torrentAvailability( tr_torrent_t * tor, uint8_t * tab, int size ) 426 { 427 int i, j, piece; 428 429 tr_lockLock( &tor->lock ); 430 for( i = 0; i < size; i++ ) 431 { 432 piece = i * tor->info.pieceCount / size; 420 433 421 434 if( tr_cpPieceIsComplete( tor->completion, piece ) ) 422 435 { 423 s->pieces[i] = -1;436 tab[i] = -1; 424 437 continue; 425 438 } 426 439 427 s->pieces[i] = 0; 428 440 tab[i] = 0; 429 441 for( j = 0; j < tor->peerCount; j++ ) 430 442 { … … 432 444 tr_bitfieldHas( tr_peerBitfield( tor->peers[j] ), piece ) ) 433 445 { 434 ( s->pieces[i])++;446 (tab[i])++; 435 447 } 436 448 } 437 449 } 438 439 s->downloaded = tor->downloaded;440 s->uploaded = tor->uploaded;441 442 450 tr_lockUnlock( &tor->lock ); 443 444 return s;445 451 } 446 452 -
branches/new_api/libtransmission/transmission.h
r139 r140 170 170 171 171 /*********************************************************************** 172 * tr_torrentAvailability 173 *********************************************************************** 174 * Use this to draw an advanced progress bar which is 'size' pixels 175 * wide. Fills 'tab' which you must have allocated: each byte is set 176 * to either -1 if we have the piece, otherwise it is set to the number 177 * of connected peers who have the piece. 178 **********************************************************************/ 179 void tr_torrentAvailability( tr_torrent_t *, uint8_t * tab, int size ); 180 181 /*********************************************************************** 172 182 * tr_torrentClose 173 183 *********************************************************************** … … 240 250 int peersUploading; 241 251 int peersDownloading; 242 char pieces[120];243 252 int seeders; 244 253 int leechers;
Note: See TracChangeset
for help on using the changeset viewer.