light: maintain limiter rates even when switched off

This commit is contained in:
Thomas Schoebel-Theuer 2014-03-25 19:34:17 +01:00
parent 2f4696a9cc
commit 8af22a1785
1 changed files with 5 additions and 8 deletions

View File

@ -1408,9 +1408,9 @@ static
void _show_rate(struct mars_rotate *rot, struct mars_limiter *limiter, bool running, const char *name)
{
int rate = limiter->lim_rate;
if (!running)
rate = 0;
__show_actual(rot->parent_path, name, rate);
if (!running)
mars_limit(limiter, 0);
}
///////////////////////////////////////////////////////////////////////
@ -3617,14 +3617,11 @@ done:
}
_show_actual(rot->parent_path, "is-replaying", rot->trans_brick && rot->trans_brick->replay_mode && !rot->trans_brick->power.led_off);
if (rot->trans_brick)
_show_rate(rot, &rot->replay_limiter, rot->trans_brick->power.led_on, "replay_rate");
_show_rate(rot, &rot->replay_limiter, rot->trans_brick && rot->trans_brick->power.led_on, "replay_rate");
_show_actual(rot->parent_path, "is-copying", rot->fetch_brick && !rot->fetch_brick->power.led_off);
if (rot->fetch_brick)
_show_rate(rot, &rot->fetch_limiter, rot->fetch_brick->power.led_on, "file_rate");
_show_rate(rot, &rot->fetch_limiter, rot->fetch_brick && rot->fetch_brick->power.led_on, "file_rate");
_show_actual(rot->parent_path, "is-syncing", rot->sync_brick && !rot->sync_brick->power.led_off);
if (rot->sync_brick)
_show_rate(rot, &rot->sync_limiter, rot->sync_brick->power.led_on, "sync_rate");
_show_rate(rot, &rot->sync_limiter, rot->sync_brick && rot->sync_brick->power.led_on, "sync_rate");
err:
return status;
}