From e0a3ad423db070bee076216d9d94587b40fdc680 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 30 Nov 2016 07:59:30 +0100 Subject: [PATCH] Handle timers which should be executed right away --- common/rfb/Timer.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/rfb/Timer.cxx b/common/rfb/Timer.cxx index efae36e2..e2aefacc 100644 --- a/common/rfb/Timer.cxx +++ b/common/rfb/Timer.cxx @@ -129,6 +129,9 @@ void Timer::start(int timeoutMs_) { gettimeofday(&now, 0); stop(); timeoutMs = timeoutMs_; + // The rest of the code assumes non-zero timeout + if (timeoutMs <= 0) + timeoutMs = 1; dueTime = addMillis(now, timeoutMs); insertTimer(this); } -- 2.39.5