Changeset 10143


Ignore:
Timestamp:
Feb 8, 2010, 7:21:07 PM (12 years ago)
Author:
charles
Message:

(trunk libT) #2874 "Since 10094 The Schedule Speed Limit Not Working" -- fixed regression reported by bebbo

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/session.c

    r10135 r10143  
    627627}
    628628
    629 static void turtleBootstrap( tr_session *, struct tr_turtle_info *, tr_bool isEnabled );
     629static void turtleBootstrap( tr_session *, struct tr_turtle_info * );
    630630
    631631static void
     
    779779    if( tr_bencDictFindBool( settings, TR_PREFS_KEY_ALT_SPEED_TIME_ENABLED, &boolVal ) )
    780780        turtle->isClockEnabled = boolVal;
    781 
    782     if( !tr_bencDictFindBool( settings, TR_PREFS_KEY_ALT_SPEED_ENABLED, &boolVal ) )
    783         boolVal = FALSE;
    784     turtleBootstrap( session, turtle, boolVal );
     781    turtleBootstrap( session, turtle );
    785782
    786783    data->done = TRUE;
     
    11541151}
    11551152
    1156 static tr_bool
    1157 turtleTestClock( struct tr_turtle_info * t, tr_bool * enabled )
    1158 {
    1159     tr_bool hit;
    1160 
    1161     if(( hit = ( t->testedAt < t->_nextChangeAt ) && ( t->_nextChangeAt <= tr_time( ))))
    1162         *enabled = t->_nextChangeValue;
    1163 
    1164     return hit;
    1165 }
    1166 
    11671153static void
    11681154turtleCheckClock( tr_session * session, struct tr_turtle_info * t, tr_bool byUser )
    11691155{
    1170     tr_bool enabled;
    11711156    const time_t now = tr_time( );
    1172     const tr_bool hit = turtleTestClock( t, &enabled );
     1157    const tr_bool hit = ( t->testedAt < t->_nextChangeAt ) && ( t->_nextChangeAt <= tr_time( ));
    11731158
    11741159    t->testedAt = now;
     
    11761161    if( hit )
    11771162    {
     1163        const tr_bool enabled = t->_nextChangeValue;
     1164
    11781165        if( t->isClockEnabled && t->_nextChangeAllowed )
    11791166        {
     
    11901177 * and turns on turtle mode if the clock settings say to. */
    11911178static void
    1192 turtleBootstrap( tr_session * session, struct tr_turtle_info * turtle, tr_bool isEnabled )
    1193 {
     1179turtleBootstrap( tr_session * session, struct tr_turtle_info * turtle )
     1180{
     1181    tr_bool isEnabled;
     1182
    11941183    turtleFindNextChange( turtle );
    1195 
    1196     if( !isEnabled )
    1197         turtleTestClock( turtle, &isEnabled );
    1198 
     1184    isEnabled = turtle->isClockEnabled && !turtle->_nextChangeValue;
    11991185    useAltSpeed( session, turtle, isEnabled, FALSE );
    12001186}
Note: See TracChangeset for help on using the changeset viewer.