(trunk libT) #1829: high CPU use in refillPiece()
This commit is contained in:
parent
9cc421d6a2
commit
91940d1c07
|
@ -705,6 +705,12 @@ blockIteratorNext( struct tr_blockIterator * i, tr_block_index_t * setme )
|
|||
return found;
|
||||
}
|
||||
|
||||
static void
|
||||
blockIteratorSkipCurrentPiece( struct tr_blockIterator * i )
|
||||
{
|
||||
i->blockIndex = i->blockCount;
|
||||
}
|
||||
|
||||
static void
|
||||
blockIteratorFree( struct tr_blockIterator ** inout )
|
||||
{
|
||||
|
@ -812,7 +818,7 @@ refillPulse( void * vtorrent )
|
|||
&& (( hasNext = blockIteratorNext( t->refillQueue, &block ))) )
|
||||
{
|
||||
int j;
|
||||
int handled = FALSE;
|
||||
tr_bool handled = FALSE;
|
||||
|
||||
const tr_piece_index_t index = tr_torBlockPiece( tor, block );
|
||||
const uint32_t offset = getBlockOffsetInPiece( tor, block );
|
||||
|
@ -867,6 +873,9 @@ refillPulse( void * vtorrent )
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !handled )
|
||||
blockIteratorSkipCurrentPiece( t->refillQueue );
|
||||
}
|
||||
|
||||
/* cleanup */
|
||||
|
|
Loading…
Reference in New Issue