[nginx] Events: simplified cycle in ngx_event_expire_timers().
Valentin Bartenev
vbart at nginx.com
Thu Oct 30 22:24:42 UTC 2014
details: http://hg.nginx.org/nginx/rev/0f53e5fb7205
branches:
changeset: 5895:0f53e5fb7205
user: Valentin Bartenev <vbart at nginx.com>
date: Mon Aug 25 13:37:06 2014 +0400
description:
Events: simplified cycle in ngx_event_expire_timers().
diffstat:
src/event/ngx_event_timer.c | 34 ++++++++++++++++------------------
1 files changed, 16 insertions(+), 18 deletions(-)
diffs (52 lines):
diff -r 1f513d7f1b45 -r 0f53e5fb7205 src/event/ngx_event_timer.c
--- a/src/event/ngx_event_timer.c Mon Aug 25 13:34:39 2014 +0400
+++ b/src/event/ngx_event_timer.c Mon Aug 25 13:37:06 2014 +0400
@@ -67,32 +67,30 @@ ngx_event_expire_timers(void)
node = ngx_rbtree_min(root, sentinel);
- /* node->key <= ngx_current_time */
+ /* node->key > ngx_current_time */
- if ((ngx_msec_int_t) (node->key - ngx_current_msec) <= 0) {
- ev = (ngx_event_t *) ((char *) node - offsetof(ngx_event_t, timer));
+ if ((ngx_msec_int_t) (node->key - ngx_current_msec) > 0) {
+ return;
+ }
- ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0,
- "event timer del: %d: %M",
- ngx_event_ident(ev->data), ev->timer.key);
+ ev = (ngx_event_t *) ((char *) node - offsetof(ngx_event_t, timer));
- ngx_rbtree_delete(&ngx_event_timer_rbtree, &ev->timer);
+ ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0,
+ "event timer del: %d: %M",
+ ngx_event_ident(ev->data), ev->timer.key);
+
+ ngx_rbtree_delete(&ngx_event_timer_rbtree, &ev->timer);
#if (NGX_DEBUG)
- ev->timer.left = NULL;
- ev->timer.right = NULL;
- ev->timer.parent = NULL;
+ ev->timer.left = NULL;
+ ev->timer.right = NULL;
+ ev->timer.parent = NULL;
#endif
- ev->timer_set = 0;
+ ev->timer_set = 0;
- ev->timedout = 1;
+ ev->timedout = 1;
- ev->handler(ev);
-
- continue;
- }
-
- break;
+ ev->handler(ev);
}
}
More information about the nginx-devel
mailing list