remove unused function tr_cpMostMissingBlockInPiece()

This commit is contained in:
Charles Kerr 2007-07-24 17:08:45 +00:00
parent e1c18610be
commit 339005346c
4 changed files with 6 additions and 59 deletions

View File

@ -230,54 +230,6 @@ int tr_cpMissingBlockInPiece( const tr_completion_t * cp, int piece )
return -1;
}
int tr_cpMostMissingBlockInPiece( const tr_completion_t * cp,
int piece,
int * downloaders )
{
tr_torrent_t * tor = cp->tor;
int start, count, end, i;
int * pool, poolSize, min, ret;
start = tr_pieceStartBlock( piece );
count = tr_cpCountBlocks( cp, piece );
end = start + count;
pool = tr_new( int, count );
poolSize = 0;
min = 255;
for( i = start; i < end; i++ )
{
if( tr_cpBlockIsComplete( cp, i ) || cp->blockDownloaders[i] > min )
{
continue;
}
if( cp->blockDownloaders[i] < min )
{
min = cp->blockDownloaders[i];
poolSize = 0;
}
if( cp->blockDownloaders[i] <= min )
{
pool[poolSize++] = i;
}
}
if( poolSize > 0 )
{
ret = pool[0];
*downloaders = min;
}
else
{
ret = -1;
}
tr_free( pool );
return ret;
}
/***
****
***/

View File

@ -59,7 +59,5 @@ float tr_cpPercentBlocksInPiece( const tr_completion_t * cp, int
/* Missing = we don't have it and we are not getting it from any peer yet */
int tr_cpMissingBlocksForPiece( const tr_completion_t * cp, int piece );
int tr_cpMissingBlockInPiece( const tr_completion_t *, int piece );
int tr_cpMostMissingBlockInPiece( const tr_completion_t *, int piece,
int * downloaders );
#endif

View File

@ -668,9 +668,7 @@ writeEnd:
{
int unused;
const int piece = pool[i];
const int block = endgame
? tr_cpMostMissingBlockInPiece( tor->completion, piece, &unused)
: tr_cpMissingBlockInPiece ( tor->completion, piece );
const int block = tr_cpMissingBlockInPiece ( tor->completion, piece );
if( block>=0 )
sendRequest( tor, peer, block );

View File

@ -1372,6 +1372,11 @@ int _tr_blockPiece( const tr_torrent_t * tor, int block )
return (block * tor->blockSize) / tor->info.pieceSize;
}
int _tr_pieceStartBlock( const tr_torrent_t * tor, int piece )
{
return (piece * tor->info.pieceSize) / tor->blockSize;
}
int _tr_blockSize( const tr_torrent_t * tor, int block )
{
const tr_info_t * inf = &tor->info;
@ -1397,12 +1402,6 @@ int _tr_pieceCountBlocks( const tr_torrent_t * tor, int piece )
return tor->blockCount % ( inf->pieceSize / tor->blockSize );
}
int _tr_pieceStartBlock( const tr_torrent_t * tor, int piece )
{
const tr_info_t * inf = &tor->info;
return piece * ( inf->pieceSize / tor->blockSize );
}
int _tr_pieceSize( const tr_torrent_t * tor, int piece )
{
const tr_info_t * inf = &tor->info;