mirror of
https://github.com/transmission/transmission
synced 2024-12-25 09:13:06 +00:00
Apply changes in scheduled limits when they're updated during the schedule
This commit is contained in:
parent
bac067e32b
commit
afd31cd0f2
1 changed files with 21 additions and 0 deletions
21
gtk/main.c
21
gtk/main.c
|
@ -553,6 +553,23 @@ updateScheduledLimits(gpointer data)
|
|||
|
||||
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;
|
||||
}
|
||||
|
@ -1070,6 +1087,10 @@ g_message( "setting encryption to %d", encryption );
|
|||
const int limit = pref_int_get( key );
|
||||
tr_sessionSetSpeedLimit( tr, TR_UP, limit );
|
||||
}
|
||||
else if ( !strncmp( key, "sched-", 6 ) )
|
||||
{
|
||||
updateScheduledLimits( tr );
|
||||
}
|
||||
else if( !strcmp( key, PREF_KEY_PORT_FORWARDING ) )
|
||||
{
|
||||
const gboolean enabled = pref_flag_get( key );
|
||||
|
|
Loading…
Reference in a new issue