CODE:
ngx_http_request_t *r;
+ ngx_msec_t sleep;
ngx_http_perl_ctx_t *ctx;
ngx_http_perl_set_request(r);
+ sleep = SvIV(ST(1));
+
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ "perl sleep: %M", sleep);
+
ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module);
- ctx->sleep = SvIV(ST(1));
ctx->next = SvRV(ST(2));
- ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "perl sleep: %d", ctx->sleep);
+ ngx_add_timer(r->connection->write, sleep);
+
+ r->write_event_handler = ngx_http_perl_sleep_handler;
void
ngx_http_ssi_ctx_t *ssi_ctx, ngx_str_t **params);
#endif
-static void ngx_http_perl_sleep_handler(ngx_http_request_t *r);
static char *ngx_http_perl_init_interpreter(ngx_conf_t *cf,
ngx_http_perl_main_conf_t *pmcf);
static PerlInterpreter *ngx_http_perl_create_interpreter(ngx_conf_t *cf,
ctx->filename.data = NULL;
ctx->redirect_uri.len = 0;
- if (ctx->sleep) {
- ngx_add_timer(r->connection->write, (ngx_msec_t) ctx->sleep);
- r->write_event_handler = ngx_http_perl_sleep_handler;
- ctx->sleep = 0;
- }
-
if (ctx->done || ctx->next) {
return;
}
}
-static void
+void
ngx_http_perl_sleep_handler(ngx_http_request_t *r)
{
ngx_event_t *wev;
ngx_str_t redirect_args;
SV *next;
- int sleep;
- ngx_uint_t done; /* unsigned done:1; */
+ ngx_uint_t done; /* unsigned done:1; */
ngx_array_t *variables; /* array of ngx_http_perl_var_t */
void ngx_http_perl_handle_request(ngx_http_request_t *r);
+void ngx_http_perl_sleep_handler(ngx_http_request_t *r);
#endif /* _NGX_HTTP_PERL_MODULE_H_INCLUDED_ */