Changeset 3618


Ignore:
Timestamp:
Oct 28, 2007, 7:42:46 PM (14 years ago)
Author:
charles
Message:

#426 0.91rc1: if pex is disabled on a stopped torrent, pressing "resume" causes pex to be re-enabled. (reported by pea)

Location:
branches/0.9x/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/0.9x/libtransmission/fastresume.c

    r3573 r3618  
    524524
    525525static uint64_t
     526internalIdToPublicBitfield( uint8_t id )
     527{
     528    uint64_t ret = 0;
     529
     530    switch( id )
     531    {
     532        case FR_ID_PROGRESS_SLOTS: ret = 0;                 break;
     533        case FR_ID_DOWNLOADED:     ret = TR_FR_DOWNLOADED;  break;
     534        case FR_ID_UPLOADED:       ret = TR_FR_UPLOADED;    break;
     535        case FR_ID_PEERS_OLD:      ret = TR_FR_PEERS;       break;
     536        case FR_ID_PROGRESS:       ret = TR_FR_PROGRESS;    break;
     537        case FR_ID_PRIORITY:       ret = TR_FR_PRIORITY;    break;
     538        case FR_ID_SPEED:          ret = TR_FR_SPEEDLIMIT;  break;
     539        case FR_ID_RUN:            ret = TR_FR_RUN;         break;
     540        case FR_ID_CORRUPT:        ret = TR_FR_CORRUPT;     break;
     541        case FR_ID_PEERS:          ret = TR_FR_PEERS;       break;
     542        case FR_ID_DESTINATION:    ret = TR_FR_DESTINATION; break;
     543        case FR_ID_PEX:            ret = TR_FR_PEX;         break;
     544    }
     545
     546    return ret;
     547}
     548
     549static uint64_t
    526550fastResumeLoadImpl ( tr_torrent   * tor,
     551                     uint64_t       fieldsToLoad,
    527552                     tr_bitfield  * uncheckedPieces,
    528553                     const char   * destination,
     
    575600    while( 1 == fread( &id, 1, 1, file ) && 1 == fread( &len, 4, 1, file ) )
    576601    {
    577         switch( id )
     602        if( fieldsToLoad & internalIdToPublicBitfield( id ) ) switch( id )
    578603        {
    579604            case FR_ID_PROGRESS:
     
    774799uint64_t
    775800tr_fastResumeLoad( tr_torrent   * tor,
     801                   uint64_t       fieldsToLoad,
    776802                   tr_bitfield  * uncheckedPieces,
    777803                   const char   * destination,
    778804                   int            argIsFallback )
    779805{
    780     const uint64_t ret = fastResumeLoadImpl( tor, uncheckedPieces, destination, argIsFallback );
     806    const uint64_t ret = fastResumeLoadImpl( tor, fieldsToLoad, uncheckedPieces, destination, argIsFallback );
    781807
    782808    if( ! ( ret & TR_FR_PROGRESS ) )
  • branches/0.9x/libtransmission/fastresume.h

    r3573 r3618  
    4646 */
    4747uint64_t tr_fastResumeLoad( tr_torrent          * tor,
     48                            uint64_t              fieldsToLoad,
    4849                            struct tr_bitfield  * uncheckedPieces,
    4950                            const char          * destination,
  • branches/0.9x/libtransmission/peer-mgr.c

    r3605 r3618  
    13641364    int i, size;
    13651365    const Torrent * t;
    1366     const tr_peer ** peers;
     1366    tr_peer ** peers;
    13671367    tr_peer_stat * ret;
    13681368
     
    13711371
    13721372    t = getExistingTorrent( (tr_peerMgr*)manager, torrentHash );
    1373     peers = (const tr_peer **) tr_ptrArrayPeek( t->peers, &size );
    1374 
     1373    peers = getConnectedPeers( (Torrent*)t, &size );
    13751374    ret = tr_new0( tr_peer_stat, size );
    13761375
     
    13941393
    13951394    *setmeCount = size;
     1395    tr_free( peers );
    13961396
    13971397    managerUnlock( (tr_peerMgr*)manager );
  • branches/0.9x/libtransmission/torrent.c

    r3591 r3618  
    339339    uncheckedPieces = tr_bitfieldNew( tor->info.pieceCount );
    340340
    341     loaded = tr_fastResumeLoad( tor, uncheckedPieces, destination, destinationIsFallback );
     341    loaded = tr_fastResumeLoad( tor, ~0, uncheckedPieces, destination, destinationIsFallback );
    342342    assert( tor->destination != NULL );
    343343
     
    10311031        if( !tor->uncheckedPieces )
    10321032            tor->uncheckedPieces = tr_bitfieldNew( tor->info.pieceCount );
    1033         tr_fastResumeLoad( tor, tor->uncheckedPieces, tor->destination, FALSE );
     1033        tr_fastResumeLoad( tor, TR_FR_PROGRESS, tor->uncheckedPieces, tor->destination, FALSE );
    10341034        tor->isRunning = 1;
    10351035        tr_ioRecheckAdd( tor, checkAndStartCB );
Note: See TracChangeset for help on using the changeset viewer.