Changeset 3398


Ignore:
Timestamp:
Oct 13, 2007, 3:29:15 PM (14 years ago)
Author:
charles
Message:

more banging on the fastresume-destination-directory thing. this permuation makes the fastresume destination a fallback, to be used only if the client didn't pass in a directory to tr_torrentInit*()

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fastresume.c

    r3396 r3398  
    321321
    322322static int
    323 loadDestination( tr_torrent * tor, FILE * fp )
     323loadFallbackDestination( tr_torrent * tor, FILE * fp )
    324324{
    325325    int pathlen = 0;
    326326    char path[MAX_PATH_LENGTH];
     327    const int haveDestination = tor->destination && *tor->destination;
    327328
    328329    for( ;; ) {
     
    337338    path[pathlen] = '\0';
    338339
    339     if( pathlen ) {
     340    if( pathlen && !haveDestination ) {
    340341        tr_free( tor->destination );
    341342        tor->destination = tr_strdup( path );
     
    514515static uint64_t
    515516fastResumeLoadImpl ( tr_torrent   * tor,
    516                      const char   * fallbackDestination,
    517517                     tr_bitfield  * uncheckedPieces )
    518518{
     
    526526    assert( tor != NULL );
    527527    assert( uncheckedPieces != NULL );
    528 
    529     /* initialize the fallback values */
    530     tor->destination = tr_strdup( fallbackDestination );
    531528
    532529    /* Open resume file */
     
    622619            case FR_ID_DESTINATION:
    623620                {
    624                     const int rret = loadDestination( tor, file );
     621                    const int rret = loadFallbackDestination( tor, file );
    625622
    626623                    if( rret && ( feof(file) || ferror(file) ) )
     
    752749uint64_t
    753750tr_fastResumeLoad( tr_torrent   * tor,
    754                    const char   * fallbackDestination,
    755751                   tr_bitfield  * uncheckedPieces )
    756752{
    757     const uint64_t ret = fastResumeLoadImpl( tor, fallbackDestination, uncheckedPieces );
     753    const uint64_t ret = fastResumeLoadImpl( tor, uncheckedPieces );
    758754
    759755    if( ! ( ret & TR_FR_PROGRESS ) )
  • trunk/libtransmission/fastresume.h

    r3387 r3398  
    4545 */
    4646uint64_t tr_fastResumeLoad( tr_torrent          * tor,
    47                             const char          * fallbackDestination,
    4847                            struct tr_bitfield  * uncheckedPieces );
    4948
  • trunk/libtransmission/torrent.c

    r3393 r3398  
    270270    tr_globalLock( h );
    271271
     272    tor->destination = tr_strdup( destination );
     273
    272274    tor->handle   = h;
    273275    tor->pexDisabled = 0;
     
    340342    uncheckedPieces = tr_bitfieldNew( tor->info.pieceCount );
    341343
    342     loaded = tr_fastResumeLoad( tor, destination, uncheckedPieces );
    343 
     344    loaded = tr_fastResumeLoad( tor, uncheckedPieces );
    344345    assert( tor->destination != NULL );
    345346
Note: See TracChangeset for help on using the changeset viewer.