tweak ra timer code to avoid missing events.

This commit is contained in:
Simon Kelley
2012-03-25 14:49:54 +01:00
parent 5d71d83420
commit 7dbe98147d

View File

@@ -395,11 +395,11 @@ time_t periodic_ra(time_t now)
for (next_event = 0, context = daemon->ra_contexts; context; context = context->next) for (next_event = 0, context = daemon->ra_contexts; context; context = context->next)
if (context->ra_time != 0) if (context->ra_time != 0)
{ {
if (difftime(context->ra_time, now) < 0.0) if (difftime(context->ra_time, now) <= 0.0)
break; /* overdue */ break; /* overdue */
if (next_event == 0 || difftime(next_event, context->ra_time + 2) > 0.0) if (next_event == 0 || difftime(next_event, context->ra_time) > 0.0)
next_event = context->ra_time + 2; next_event = context->ra_time;
} }
/* none overdue */ /* none overdue */