~ubuntu-branches/ubuntu/jaunty/transmission/jaunty-security

« back to all changes in this revision

Viewing changes to libtransmission/inout.c

  • Committer: Bazaar Package Importer
  • Author(s): Philipp Benner
  • Date: 2007-10-29 19:53:02 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20071029195302-gyy129sjmci7ezel
Tags: 0.91.dfsg-1
* New upstream release (Closes: #448516).
* Using manpages from source package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 * This exemption does not extend to derived works not owned by
8
8
 * the Transmission project.
9
9
 *
10
 
 * $Id: inout.c 3480 2007-10-20 20:36:01Z charles $
 
10
 * $Id: inout.c 3605 2007-10-27 21:29:39Z charles $
11
11
 */
12
12
 
13
13
#include <assert.h>
378
378
tr_ioRecheckAdd( tr_torrent          * tor,
379
379
                 tr_recheck_done_cb    recheck_done_cb )
380
380
{
381
 
    struct recheck_node * node;
382
 
    node = tr_new( struct recheck_node, 1 );
383
 
    node->torrent = tor;
384
 
    node->recheck_done_cb = recheck_done_cb;
385
 
 
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 ) )
 
382
    {
 
383
        /* doesn't need to be checked... */
 
384
        recheck_done_cb( tor );
 
385
    }
 
386
    else
 
387
    {
 
388
        struct recheck_node * node;
 
389
 
 
390
        node = tr_new( struct recheck_node, 1 );
 
391
        node->torrent = tor;
 
392
        node->recheck_done_cb = recheck_done_cb;
 
393
 
 
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( ) );
 
400
    }
392
401
}
393
402
 
394
403
static int
418
427
    else
419
428
    {
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,
423
 
                                                     &tmp,
424
 
                                                     compareRecheckByTorrent );
 
432
        node = tr_list_remove( &recheckList,
 
433
                               &tmp,
 
434
                               compareRecheckByTorrent );
425
435
        tr_free( node );
426
436
        tor->recheckState = TR_RECHECK_NONE;
427
437
    }