Changeset 11751


Ignore:
Timestamp:
Jan 22, 2011, 7:56:01 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) #3934 "manual reannounce doesn't work if the initial announce failed" -- fixed.

Use tor->isRunning, rather than tier->isRunning, when testing to see if a torrent can manual announce or not. tor->isRunning means we're inbetween the user pressing "start" and "stop." tier->isRunning means we're inbetween successful "started" and "stopped" announcements. (This is deliberately out-of-sync from tor->isRunning because it can take awhile to for tracker announces to finish.)

Under the old code (using tier->isRunning), it was impossible to manually reannounce unless there had been a successful event=started announce first. It was also possible to manually announce after the "stop" button had been pressed if the "event=stopped" announcement hadn't finished yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer.c

    r11750 r11751  
    923923tierCanManualAnnounce( const tr_tier * tier )
    924924{
    925     return tier->isRunning
    926         && tier->manualAnnounceAllowedAt <= tr_time( );
     925    return tier->manualAnnounceAllowedAt <= tr_time( );
    927926}
    928927
     
    936935    assert( tr_isTorrent( tor ) );
    937936    assert( tor->tiers != NULL );
     937
     938    if( !tor->isRunning )
     939        return FALSE;
    938940
    939941    n = tr_ptrArraySize( &tor->tiers->tiers );
     
    13791381    {
    13801382        tier->isAnnouncing = FALSE;
     1383        tier->manualAnnounceAllowedAt = now + tier->announceMinIntervalSec;
    13811384
    13821385        if( responseCode == 0 )
     
    13841387            const int interval = getRetryInterval( tier->currentTracker );
    13851388            dbgmsg( tier, "No response from tracker... retrying in %d seconds.", interval );
    1386             tier->manualAnnounceAllowedAt = ~(time_t)0;
    13871389            tierAddAnnounce( tier, announceEvent, now + interval );
    13881390        }
     
    13991401            }
    14001402
    1401             tier->manualAnnounceAllowedAt = now + tier->announceMinIntervalSec;
    1402 
    14031403            /* if we're running and the queue is empty, add the next update */
    14041404            if( !isStopped && !tr_ptrArraySize( &tier->announceEvents ) )
     
    14131413            dbgmsg( tier, "got a redirect. retrying in %d seconds", interval );
    14141414            tierAddAnnounce( tier, announceEvent, now + interval );
    1415             tier->manualAnnounceAllowedAt = now + tier->announceMinIntervalSec;
    14161415        }
    14171416        else if( ( responseCode == 404 ) || ( 500 <= responseCode && responseCode <= 599 ) )
     
    14251424             * So we pause a bit and try again. */
    14261425
    1427             const int interval = getRetryInterval( tier->currentTracker );
    1428             tier->manualAnnounceAllowedAt = ~(time_t)0;
    1429             tierAddAnnounce( tier, announceEvent, now + interval );
     1426            tierAddAnnounce( tier, announceEvent, now + getRetryInterval( tier->currentTracker ) );
    14301427        }
    14311428        else if( 400 <= responseCode && responseCode <= 499 )
     
    14441441            const int interval = 120;
    14451442            dbgmsg( tier, "Invalid response from tracker... retrying in two minutes." );
    1446             tier->manualAnnounceAllowedAt = ~(time_t)0;
    14471443            tierAddAnnounce( tier, announceEvent, now + interval );
    14481444        }
Note: See TracChangeset for help on using the changeset viewer.