static void
ngx_http_echo_post_read_request_body(ngx_http_request_t *r)
{
    ngx_http_echo_ctx_t         *ctx;

    ctx = ngx_http_get_module_ctx(r, ngx_http_echo_module);

    dd("wait read request body %d", (int) ctx->wait_read_request_body);

    if (ctx->wait_read_request_body) {
        ctx->waiting = 0;
        ctx->done = 1;

        r->write_event_handler = ngx_http_echo_wev_handler;

        ngx_http_echo_wev_handler(r);
    }
}
Exemple #2
0
static void
ngx_http_echo_post_sleep(ngx_http_request_t *r)
{
    ngx_http_echo_ctx_t         *ctx;
    /* ngx_int_t                    rc; */

    dd("entered echo post sleep...(r->done: %d)", r->done);

    dd("sleep: before get module ctx");

    ctx = ngx_http_get_module_ctx(r, ngx_http_echo_module);

    if (ctx == NULL) {
        return;
    }

    ctx->waiting = 0;
    ctx->done = 1;

    dd("sleep: after get module ctx");

    dd("timed out? %d", ctx->sleep.timedout);
    dd("timer set? %d", ctx->sleep.timer_set);

    if ( ! ctx->sleep.timedout ) {
        dd("HERE reached!");
        return;
    }

    ctx->sleep.timedout = 0;

    if (ctx->sleep.timer_set) {
        dd("deleting timer for echo_sleep");

        ngx_del_timer(&ctx->sleep);
    }

    /* r->write_event_handler = ngx_http_request_empty_handler; */

    ngx_http_echo_wev_handler(r);
}
static void
ngx_http_echo_post_sleep(ngx_http_request_t *r)
{
    ngx_http_echo_ctx_t         *ctx;
    /* ngx_int_t                    rc; */

    dd("post sleep, r:%.*s", (int) r->uri.len, r->uri.data);

    ctx = ngx_http_get_module_ctx(r, ngx_http_echo_module);

    if (ctx == NULL) {
        return;
    }

    ctx->waiting = 0;
    ctx->done = 1;

    dd("sleep: after get module ctx");

    dd("timed out? %d", ctx->sleep.timedout);
    dd("timer set? %d", ctx->sleep.timer_set);

    if (!ctx->sleep.timedout) {
        dd("HERE reached!");
        return;
    }

    ctx->sleep.timedout = 0;

    if (ctx->sleep.timer_set) {
        dd("deleting timer for echo_sleep");

        ngx_del_timer(&ctx->sleep, NGX_FUNC_LINE);
    }

    /* r->write_event_handler = ngx_http_request_empty_handler; */

    ngx_http_echo_wev_handler(r);
}