Skip deleted timers when calculting next timeout

It is possible for there to be deleted timers when we
calculate the next timeout, and they must be skipped.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit afbd96678e)
This commit is contained in:
Daniel P. Berrange 2012-11-22 16:43:57 +00:00 committed by Cole Robinson
parent 9d239b5956
commit 1f45a3233c

View File

@ -332,6 +332,8 @@ static int virEventPollCalculateTimeout(int *timeout) {
EVENT_DEBUG("Calculate expiry of %zu timers", eventLoop.timeoutsCount);
/* Figure out if we need a timeout */
for (i = 0 ; i < eventLoop.timeoutsCount ; i++) {
if (eventLoop.timeouts[i].deleted)
continue;
if (eventLoop.timeouts[i].frequency < 0)
continue;