comparison src/http/modules/ngx_http_limit_req_module.c @ 3191:30f841e2536d

fix r3184
author Igor Sysoev <igor@sysoev.ru>
date Tue, 06 Oct 2009 16:08:15 +0000
parents 30570a5b9bb0
children eb156d98a9fa
comparison
equal deleted inserted replaced
3190:dd2ae3872634 3191:30f841e2536d
396 now = (ngx_msec_t) (tp->sec * 1000 + tp->msec); 396 now = (ngx_msec_t) (tp->sec * 1000 + tp->msec);
397 ms = (ngx_msec_int_t) (now - lr->last); 397 ms = (ngx_msec_int_t) (now - lr->last);
398 398
399 excess = lr->excess - ctx->rate * ngx_abs(ms) / 1000 + 1000; 399 excess = lr->excess - ctx->rate * ngx_abs(ms) / 1000 + 1000;
400 400
401 if (excess < 0) {
402 excess = 0;
403 }
404
401 if ((ngx_uint_t) excess > lrcf->burst) { 405 if ((ngx_uint_t) excess > lrcf->burst) {
402 *lrp = lr; 406 *lrp = lr;
403 return NGX_BUSY; 407 return NGX_BUSY;
404 }
405
406 if (excess < 0) {
407 excess = 0;
408 } 408 }
409 409
410 lr->excess = excess; 410 lr->excess = excess;
411 lr->last = now; 411 lr->last = now;
412 412