378
378
tr_ioRecheckAdd( tr_torrent * tor,
379
379
tr_recheck_done_cb recheck_done_cb )
381
struct recheck_node * node;
382
node = tr_new( struct recheck_node, 1 );
384
node->recheck_done_cb = recheck_done_cb;
386
tr_lockLock( getRecheckLock( ) );
387
tor->recheckState = recheckList ? TR_RECHECK_WAIT : TR_RECHECK_NOW;
388
tr_list_append( &recheckList, node );
389
if( recheckThread == NULL )
390
recheckThread = tr_threadNew( recheckThreadFunc, NULL, "recheckThreadFunc" );
391
tr_lockUnlock( getRecheckLock( ) );
381
if( !tr_bitfieldCountTrueBits( tor->uncheckedPieces ) )
383
/* doesn't need to be checked... */
384
recheck_done_cb( tor );
388
struct recheck_node * node;
390
node = tr_new( struct recheck_node, 1 );
392
node->recheck_done_cb = recheck_done_cb;
394
tr_lockLock( getRecheckLock( ) );
395
tor->recheckState = recheckList ? TR_RECHECK_WAIT : TR_RECHECK_NOW;
396
tr_list_append( &recheckList, node );
397
if( recheckThread == NULL )
398
recheckThread = tr_threadNew( recheckThreadFunc, NULL, "recheckThreadFunc" );
399
tr_lockUnlock( getRecheckLock( ) );
420
429
struct recheck_node tmp;
430
struct recheck_node * node;
421
431
tmp.torrent = tor;
422
struct recheck_node * node = tr_list_remove( &recheckList,
424
compareRecheckByTorrent );
432
node = tr_list_remove( &recheckList,
434
compareRecheckByTorrent );
426
436
tor->recheckState = TR_RECHECK_NONE;