Changeset 3058


Ignore:
Timestamp:
Sep 13, 2007, 4:50:23 PM (15 years ago)
Author:
charles
Message:

remove some pieces that are now unused.

Location:
branches/encryption/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/encryption/libtransmission/completion.c

    r2987 r3058  
    3434    tr_torrent * tor;
    3535
    36     /* true if a peer is requesting this block */
    37     tr_bitfield * blockRequested;
    38 
    3936    /* do we have this block? */
    4037    tr_bitfield * blockBitfield;
     
    5956    cp->tor              = tor;
    6057    cp->blockBitfield    = tr_bitfieldNew( tor->blockCount );
    61     cp->blockRequested   = tr_bitfieldNew( tor->blockCount );
    6258    cp->pieceBitfield    = tr_bitfieldNew( tor->info.pieceCount );
    6359    cp->completeBlocks   = tr_new( uint16_t, tor->info.pieceCount );
     
    7268    tr_free(         cp->completeBlocks );
    7369    tr_bitfieldFree( cp->pieceBitfield );
    74     tr_bitfieldFree( cp->blockRequested );
    7570    tr_bitfieldFree( cp->blockBitfield );
    7671    tr_free(         cp );
     
    8378    tr_bitfieldClear( cp->pieceBitfield );
    8479    tr_bitfieldClear( cp->blockBitfield );
    85     tr_bitfieldClear( cp->blockRequested );
    8680    memset( cp->completeBlocks, 0, sizeof(uint16_t) * tor->info.pieceCount );
    8781
     
    191185}
    192186
    193 /* Blocks */
    194 void tr_cpDownloaderAdd( tr_completion * cp, int block )
    195 {
    196     tr_bitfieldAdd( cp->blockRequested, block );
    197 }
    198 
    199 void tr_cpDownloaderRem( tr_completion * cp, int block )
    200 {
    201     tr_bitfieldRem( cp->blockRequested, block );
    202 }
    203 
    204187int tr_cpBlockIsComplete( const tr_completion * cp, int block )
    205188{
     
    260243}
    261244
    262 int
    263 tr_cpMissingBlocksForPiece( const tr_completion * cp, int piece )
    264 {
    265     int i;
    266     int n;
    267     const tr_torrent * tor = cp->tor;
    268     const int start = tr_torPieceFirstBlock(tor,piece);
    269     const int end   = start + tr_torPieceCountBlocks(tor,piece);
    270 
    271     n = 0;
    272     for( i = start; i < end; ++i )
    273         if( !tr_cpBlockIsComplete( cp, i ) && !tr_bitfieldHas( cp->blockRequested, i ) )
    274             ++n;
    275 
    276     return n;
    277 }
    278 
    279 int tr_cpMissingBlockInPiece( const tr_completion * cp, int piece )
    280 {
    281     int i;
    282     const tr_torrent * tor = cp->tor;
    283     const int start = tr_torPieceFirstBlock(tor,piece);
    284     const int end   = start + tr_torPieceCountBlocks(tor,piece);
    285 
    286     for( i = start; i < end; ++i )
    287         if( !tr_cpBlockIsComplete( cp, i ) && !tr_bitfieldHas( cp->blockRequested, i ) )
    288             return i;
    289 
    290     return -1;
    291 }
    292 
    293245/***
    294246****
  • branches/encryption/libtransmission/completion.h

    r2941 r3058  
    5050
    5151/* Blocks */
    52 void             tr_cpDownloaderAdd( tr_completion *, int block );
    53 void             tr_cpDownloaderRem( tr_completion *, int block );
    5452int              tr_cpBlockIsComplete( const tr_completion *, int block );
    5553void             tr_cpBlockAdd( tr_completion *, int block );
    5654void             tr_cpBlockBitfieldSet( tr_completion *, struct tr_bitfield * );
    5755float            tr_cpPercentBlocksInPiece( const tr_completion * cp, int piece );
    58 /* Missing = we don't have it and we are not getting it from any peer yet */
    59 int              tr_cpMissingBlocksForPiece( const tr_completion * cp, int piece );
    60 int              tr_cpMissingBlockInPiece( const tr_completion *, int piece );
    6156
    6257const struct tr_bitfield * tr_cpPieceBitfield( const tr_completion* );
Note: See TracChangeset for help on using the changeset viewer.