a digest authentication module

Samizdat Drafting Co. drafting at samizdat.cc
Thu Nov 17 21:29:09 UTC 2011

On Sat, Nov 5, 2011 at 8:50 PM, Alexandr Gomoliako <zzz at zzz.org.ua> wrote:

>> i'm also a little confused as to how the module should schedule a
>> recurring node-expiration callback that purges stale entries from the
>> rbtree. at the moment the purge function is called at the top of every
>> request, which feels like the wrongest possible way to do it. i've
>> seen mention of the cleanup hook attached to the request's pool. is
>> this a more appropriate place to run or are there other problems
>> associated with that?
> Well, it's up to you to decide. But since entries are completely unrelated
> to the request you should probably move expiration somewhere else.

very true. i've switched over to creating a timer at module init-time
that schedules itself every few seconds and calls the expiration
routine as needed. it seems to be working, but i'm wondering if i've
introduced a memory leak in the process.

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?

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
experimented with setting the "oneshot" field to 0 but apparently it's
not quite that simple...

thanks again,

More information about the nginx-devel mailing list