Could someone please review this code snippet and tell me what I've missed?

Alexandr Gomoliako zzz at zzz.org.ua
Mon Dec 26 00:20:21 UTC 2011


On Mon, Dec 26, 2011 at 1:08 AM, J.Q. S. <q2011oct at gmail.com> wrote:
> As an exercise I've written a module which receives a request, sets a 10
> second timer, then replies "Hello World!" when the timer expires. I'm
> running nginx with deamon off/master off to make things as simple as
> possible. The first time through everything seems to work perfectly.
> However, the second time I don't get any response at all - from any url the
> server normally handles. This code does work though multiple invocations if
> I call bottom handler function directly from the top handler function,
> without using the timer. I was wondering if someone could spot check my code
> and tell me what I'm doing wrong?

> static ngx_int_t ngx_http_alpha_handler_bottom(ngx_event_t *ev) {
...

>   return(ngx_http_output_filter(r, &out));

You have to finalize your request manually here.

P.S.
I have a simple call tracer for nginx, should help you figure out
how everything works in no time, literally.

Check it out:
    https://github.com/zzzcpan/ngx_trace



More information about the nginx-devel mailing list