alarm: limit sleep timeout to 60s

Instead of using an unreasonable value for the sleep time, limit it to
60s.

Fixes #2188.
This commit is contained in:
Josef Söntgen 2016-12-05 14:36:24 +01:00 committed by Norman Feske
parent 71d30297ff
commit 400198013b

View File

@ -64,7 +64,10 @@ void Alarm_timeout_scheduler::handle_timeout(Microseconds curr_time)
} else {
sleep_time_us = _time_source.max_timeout().value; }
if (sleep_time_us == 0) {
/* limit max timeout to a more reasonable value, e.g. 60s */
if (sleep_time_us > 60000000) {
sleep_time_us = 60000000;
} else if (sleep_time_us == 0) {
sleep_time_us = 1; }
_time_source.schedule_timeout(Microseconds(sleep_time_us), *this);