Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions nginx_module/src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ impl<HandlerFn> Drop for Timer<HandlerFn> {
struct Data<HandlerFn> {
handler: HandlerFn,
interval_msec: usize,
// nginx debug logging reads ngx_event_ident(ev->data), i.e.
// ((ngx_connection_t *) data)->fd — 4 bytes at offset 24; keep the
// allocation large enough for that read to stay in bounds
_ident_pad: [u8; 32],
}

impl<HandlerFn: FnMut()> Timer<HandlerFn> {
Expand All @@ -44,6 +48,7 @@ impl<HandlerFn: FnMut()> Timer<HandlerFn> {
let data = Data {
handler,
interval_msec,
_ident_pad: [0; 32],
};
event.data = Box::into_raw(Box::new(data)).cast();
event.log = unsafe { (*ngx_cycle).log };
Expand Down