Two problems solved, one more found:
Solved:
1. I wasn't specifying a wakeupFromSleep->log, so I was seg faulting on the:
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ev->log, 0,
"event timer add: %d: %M:%M",
ngx_event_ident(ev->data), timer, ev->timer.key);
line in ngx_event_add_timer from ngx_event_timer.h
2. I was specifying seconds, not ms. The line should correctly read:
ngx_add_timer(wakeupFromSleep, 30000);
Found:
Like before, the connection is closing immediately, even though the event is in fact waking up. The only way I seem to be able to have it not close immediate is to set r->keepalive = 1, which closes when the event times out, but doesn't send my headers. So, like my original question, I still need a way to keep the connection open until the event times out and can send the headers and finalize the response (in 0.7.64, I'm hoping to not have to move to a later version if I can avoid it).
Thanks!