On Wed, 15 May 2013 10:24:22 +0200 Otto Moerbeek <o...@drijf.net> wrote:
> On Wed, May 15, 2013 at 10:15:54AM +0200, Gerhard Roth wrote:
> 
> > In dhcpd, variable cur_time is set only once per dispatch loop.
> > Unfortunately, this is done before the poll(2) call. Since poll(2)
> > may sleep for an arbitrary amount of time, the value of cur_time
> > might refer to some long ago point in time. When message dispatching
> > is done, timeouts and lease ends are calculated based on this
> > outdated cur_time value that was set before the call to poll(2).
> > 
> > It's fine to set cur_time only once per loop, but we should do it after
> > the blocking poll(2) syscall so that its value is more accurate.
> > 
> > ok?
> > 
> > Gerhard
> 
> I don't think the first call to time() should be left out. cur_time is
> potentially used in the first iteration of the loop. 
> 

Well, it is set in main(), so it is initialized. But nevertheless you're
that we should keep it because it is required for correct timeout
handling if there are no incoming packets.

Just sent out a second diff that keeps the time(2) call at the top
of the loop.

Gerhard

Reply via email to