Ignore:
Timestamp:
Nov 6, 2010, 3:59:51 PM (11 years ago)
Author:
charles
Message:

(trunk libT) #3716 "take torrent priority into account when choosing which torrent to verify next" -- done.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/verify.c

    r11339 r11388  
    274274
    275275static int
    276 compareVerifyBySize( const void * va, const void * vb )
     276compareVerifyByPriorityAndSize( const void * va, const void * vb )
    277277{
    278278    const struct verify_node * a = va;
    279279    const struct verify_node * b = vb;
    280280
     281    /* higher priority comes before lower priority */
     282    const tr_priority_t pa =  tr_torrentGetPriority( a->torrent );
     283    const tr_priority_t pb =  tr_torrentGetPriority( b->torrent );
     284    if( pa != pb )
     285        return pa > pb ? -1 : 1;
     286
     287    /* smaller size comes before larger size... smaller sizes are faster to verify */
    281288    if( a->current_size < b->current_size ) return -1;
    282289    if( a->current_size > b->current_size ) return  1;
     
    328335            tr_lockLock( getVerifyLock( ) );
    329336            tr_torrentSetVerifyState( tor, TR_VERIFY_WAIT );
    330             tr_list_insert_sorted( &verifyList, node, compareVerifyBySize );
     337            tr_list_insert_sorted( &verifyList, node, compareVerifyByPriorityAndSize );
    331338            if( verifyThread == NULL )
    332339                verifyThread = tr_threadNew( verifyThreadFunc, NULL );
Note: See TracChangeset for help on using the changeset viewer.