a digest authentication module

Alexandr Gomoliako zzz at zzz.org.ua
Thu Nov 17 21:59:15 UTC 2011


On Thu, Nov 17, 2011 at 11:29 PM, Samizdat Drafting Co.
<drafting at samizdat.cc> wrote:
> the relevant portion of the code is excerpted at https://gist.github.com/1374529
>
> i didn't see a way to create a recurring timer and instead the event
> handler calls ngx_add_timer() every time it is triggered (each time
> re-using the same ngx_event_t pointer i set up initially).
>
> do i also need to be calling ngx_event_del_timer to clean up after
> myself, or does the ngx_event_expire_timers get called by nginx itself
> and handle this potential leak?

Just check for it first, it's easier this way, one less thing to remeber:

    if (ev->timer_set) {
        ngx_del_timer(ev);
    }
    ...
    ngx_add_timer(ev, timeout * 1000);

> or more simply, is there a way to create a timer that fires every n
> seconds and doesn't need to be re-added each time it fires? i

No. You need to reschedule every time.



More information about the nginx-devel mailing list