Mercurial > hg > nginx
comparison src/http/modules/perl/nginx.xs @ 1897:b43f244d0430
optimize $r->sleep
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sat, 16 Feb 2008 14:23:14 +0000 |
parents | 2e3353955c32 |
children | 9a73235ce453 |
comparison
equal
deleted
inserted
replaced
1896:4c060e30476b | 1897:b43f244d0430 |
---|---|
932 void | 932 void |
933 sleep(r, sleep, next) | 933 sleep(r, sleep, next) |
934 CODE: | 934 CODE: |
935 | 935 |
936 ngx_http_request_t *r; | 936 ngx_http_request_t *r; |
937 ngx_msec_t sleep; | |
937 ngx_http_perl_ctx_t *ctx; | 938 ngx_http_perl_ctx_t *ctx; |
938 | 939 |
939 ngx_http_perl_set_request(r); | 940 ngx_http_perl_set_request(r); |
940 | 941 |
942 sleep = SvIV(ST(1)); | |
943 | |
944 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
945 "perl sleep: %M", sleep); | |
946 | |
941 ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module); | 947 ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module); |
942 | 948 |
943 ctx->sleep = SvIV(ST(1)); | |
944 ctx->next = SvRV(ST(2)); | 949 ctx->next = SvRV(ST(2)); |
945 | 950 |
946 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 951 ngx_add_timer(r->connection->write, sleep); |
947 "perl sleep: %d", ctx->sleep); | 952 |
953 r->write_event_handler = ngx_http_perl_sleep_handler; | |
948 | 954 |
949 | 955 |
950 void | 956 void |
951 log_error(r, err, msg) | 957 log_error(r, err, msg) |
952 CODE: | 958 CODE: |