[SSSD] [PATCH] Make periodic checks for DNS timeouts

Simo Sorce ssorce at redhat.com
Wed Jan 13 22:38:20 UTC 2010


On Wed, 13 Jan 2010 16:54:54 -0500
Stephen Gallagher <sgallagh at redhat.com> wrote:

> It's bad practice to modify current_time in a tevent_timer handler.

I agree with the nack, but I want to explain why it is really bad! :)

There is no problem in using the tevent_timer current_time in the
handler, it is just a copy that will die as soon as you return from the
handler.

The real problem here is that current_time is not the *actual* time, it
can easily be (0, 0).

This means that setting it to tv_sec += 1 means causing a busy loop
that spins as fast as it can because tv_sec = 1 is always in the past
and causes tevent to fire immediately. 

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York



More information about the sssd-devel mailing list