Ignore:
Timestamp:
Apr 18, 2008, 12:47:13 PM (14 years ago)
Author:
charles
Message:

handle manditory/fallback ctor settings in the bencoded resume filfes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fastresume.c

    r5616 r5641  
    662662}
    663663
    664 static uint64_t
    665 setFromCtor( tr_torrent * tor, uint64_t fields, const tr_ctor * ctor, int mode )
    666 {
    667     uint64_t ret = 0;
    668 
    669     if( fields & TR_FR_RUN ) {
    670         uint8_t isPaused;
    671         if( !tr_ctorGetPaused( ctor, mode, &isPaused ) ) {
    672             tor->isRunning = !isPaused;
    673             ret |= TR_FR_RUN;
    674         }
    675     }
    676 
    677     if( fields & TR_FR_MAX_PEERS )
    678         if( !tr_ctorGetMaxConnectedPeers( ctor, mode, &tor->maxConnectedPeers ) )
    679             ret |= TR_FR_MAX_PEERS;
    680 
    681     if( fields & TR_FR_DESTINATION ) {
    682         const char * destination;
    683         if( !tr_ctorGetDestination( ctor, mode, &destination ) ) {
    684             ret |= TR_FR_DESTINATION;
    685             tr_free( tor->destination );
    686             tor->destination = tr_strdup( destination );
    687         }
    688     }
    689 
    690     return ret;
    691 }
    692 
    693 static uint64_t
    694 useManditoryFields( tr_torrent * tor, uint64_t fields, const tr_ctor * ctor )
    695 {
    696     return setFromCtor( tor, fields, ctor, TR_FORCE );
    697 }
    698 
    699 static uint64_t
    700 useFallbackFields( tr_torrent * tor, uint64_t fields, const tr_ctor * ctor )
    701 {
    702     return setFromCtor( tor, fields, ctor, TR_FALLBACK );
    703 }
    704 
    705664uint64_t
    706665tr_fastResumeLoad( tr_torrent     * tor,
    707                    uint64_t         fieldsToLoad,
    708                    const tr_ctor  * ctor )
    709 {
    710     uint64_t ret = 0;
    711 
    712     ret |= useManditoryFields( tor, fieldsToLoad, ctor );
    713     fieldsToLoad &= ~ret;
    714     ret |= fastResumeLoadImpl( tor, fieldsToLoad );
    715     fieldsToLoad &= ~ret;
    716     ret |= useFallbackFields( tor, fieldsToLoad, ctor );
    717 
    718     return ret;
     666                   uint64_t         fieldsToLoad )
     667{
     668    return fastResumeLoadImpl( tor, fieldsToLoad );
    719669}
    720670
Note: See TracChangeset for help on using the changeset viewer.