Welcome! Log In Create A New Profile

Advanced

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

December 25, 2011 08:34PM
You probably should use ngx_http_get_module_ctx/ngx_http_set_module_ctx to
keep your timer reference,
if you want to have one timer per request.

ngx_http_get_module_loc_conf will do one timer per location.


On Sun, Dec 25, 2011 at 10:20 PM, Alexandr Gomoliako <zzz@zzz.org.ua> wrote:

> On Mon, Dec 26, 2011 at 1:08 AM, J.Q. S. <q2011oct@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
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

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

J.Q. S. 1307 December 25, 2011 06:10PM

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

Alexandr Gomoliako 499 December 25, 2011 07:22PM

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

wandenberg 663 December 25, 2011 08:34PM

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

Alexandr Gomoliako 491 December 25, 2011 09:30PM

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

J.Q. S. 529 December 25, 2011 10:24PM

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

J.Q. S. 679 December 26, 2011 12:08AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 153
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready