1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

Apply changes in scheduled limits when they're updated during the schedule

This commit is contained in:
Mukund Sivaraman 2008-09-01 10:01:13 +00:00
parent bac067e32b
commit afd31cd0f2

View file

@ -553,6 +553,23 @@ updateScheduledLimits(gpointer data)
last_state = in_sched_state; last_state = in_sched_state;
} }
else if( in_sched_state )
{
static int old_dl_limit = 0, old_ul_limit = 0;
int dl_limit = pref_int_get( PREF_KEY_SCHED_DL_LIMIT );
int ul_limit = pref_int_get( PREF_KEY_SCHED_UL_LIMIT );
if( ( dl_limit != old_dl_limit ) || ( ul_limit != old_ul_limit ) )
{
tr_sessionSetSpeedLimitEnabled( tr, TR_DOWN, TRUE );
tr_sessionSetSpeedLimit( tr, TR_DOWN, dl_limit );
tr_sessionSetSpeedLimitEnabled( tr, TR_UP, TRUE );
tr_sessionSetSpeedLimit( tr, TR_UP, ul_limit );
old_dl_limit = dl_limit;
old_ul_limit = ul_limit;
}
}
return TRUE; return TRUE;
} }
@ -1070,6 +1087,10 @@ g_message( "setting encryption to %d", encryption );
const int limit = pref_int_get( key ); const int limit = pref_int_get( key );
tr_sessionSetSpeedLimit( tr, TR_UP, limit ); tr_sessionSetSpeedLimit( tr, TR_UP, limit );
} }
else if ( !strncmp( key, "sched-", 6 ) )
{
updateScheduledLimits( tr );
}
else if( !strcmp( key, PREF_KEY_PORT_FORWARDING ) ) else if( !strcmp( key, PREF_KEY_PORT_FORWARDING ) )
{ {
const gboolean enabled = pref_flag_get( key ); const gboolean enabled = pref_flag_get( key );