Mercurial > hg > nginx-quic
comparison src/http/modules/perl/ngx_http_perl_module.c @ 1897:b43f244d0430
optimize $r->sleep
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sat, 16 Feb 2008 14:23:14 +0000 |
parents | 86bb52e28ce0 |
children | d24ef26f1205 |
comparison
equal
deleted
inserted
replaced
1896:4c060e30476b | 1897:b43f244d0430 |
---|---|
39 #if (NGX_HTTP_SSI) | 39 #if (NGX_HTTP_SSI) |
40 static ngx_int_t ngx_http_perl_ssi(ngx_http_request_t *r, | 40 static ngx_int_t ngx_http_perl_ssi(ngx_http_request_t *r, |
41 ngx_http_ssi_ctx_t *ssi_ctx, ngx_str_t **params); | 41 ngx_http_ssi_ctx_t *ssi_ctx, ngx_str_t **params); |
42 #endif | 42 #endif |
43 | 43 |
44 static void ngx_http_perl_sleep_handler(ngx_http_request_t *r); | |
45 static char *ngx_http_perl_init_interpreter(ngx_conf_t *cf, | 44 static char *ngx_http_perl_init_interpreter(ngx_conf_t *cf, |
46 ngx_http_perl_main_conf_t *pmcf); | 45 ngx_http_perl_main_conf_t *pmcf); |
47 static PerlInterpreter *ngx_http_perl_create_interpreter(ngx_conf_t *cf, | 46 static PerlInterpreter *ngx_http_perl_create_interpreter(ngx_conf_t *cf, |
48 ngx_http_perl_main_conf_t *pmcf); | 47 ngx_http_perl_main_conf_t *pmcf); |
49 static ngx_int_t ngx_http_perl_run_requires(pTHX_ ngx_array_t *requires, | 48 static ngx_int_t ngx_http_perl_run_requires(pTHX_ ngx_array_t *requires, |
250 } | 249 } |
251 | 250 |
252 ctx->filename.data = NULL; | 251 ctx->filename.data = NULL; |
253 ctx->redirect_uri.len = 0; | 252 ctx->redirect_uri.len = 0; |
254 | 253 |
255 if (ctx->sleep) { | |
256 ngx_add_timer(r->connection->write, (ngx_msec_t) ctx->sleep); | |
257 r->write_event_handler = ngx_http_perl_sleep_handler; | |
258 ctx->sleep = 0; | |
259 } | |
260 | |
261 if (ctx->done || ctx->next) { | 254 if (ctx->done || ctx->next) { |
262 return; | 255 return; |
263 } | 256 } |
264 | 257 |
265 if (uri.len) { | 258 if (uri.len) { |
274 | 267 |
275 ngx_http_finalize_request(r, rc); | 268 ngx_http_finalize_request(r, rc); |
276 } | 269 } |
277 | 270 |
278 | 271 |
279 static void | 272 void |
280 ngx_http_perl_sleep_handler(ngx_http_request_t *r) | 273 ngx_http_perl_sleep_handler(ngx_http_request_t *r) |
281 { | 274 { |
282 ngx_event_t *wev; | 275 ngx_event_t *wev; |
283 | 276 |
284 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 277 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |