<div dir="ltr">Hi<div><br></div><div>As the following codes.</div><div><br></div><div><div><br></div><div>buffer->event->handler = ngx_http_log_flush_handler;</div><div><br></div></div><div><br></div><div><div>static void</div><div>ngx_http_log_flush_handler(ngx_event_t *ev)</div><div>{</div><div> ...</div><div> if (ev->timedout) {</div><div> ngx_http_log_flush(ev->data, ev->log);</div><div> return;</div><div> }</div><div> ...</div><div>}</div></div><div><br></div><div><br></div><div><div>static void</div><div>ngx_http_log_flush(ngx_open_file_t *file, ngx_log_t *log)</div><div>{</div><div> ...</div></div><div><div> if (buffer->event && buffer->event->timer_set) {</div><div> ngx_del_timer(buffer->event); </div><div> }</div><div>}</div></div><div><br></div><div><br></div><div>I find there are two functions explicitly call event handler.</div><div>1. ngx_event_cancel_timers happened as long as worker process quits.</div><div>2. ngx_event_expire_timers in ngx_process_events_and_timers.</div><div><br></div><div>And they remove timer from timer rbtree, then set timer_set zero.</div><div>After that they call event->handler.</div><div><br></div><div>So why we call ngx_del_timer in ngx_http_log_flush again?</div><div><br></div><div>Thanks.</div><div><br></div><div>B.R~</div>
</div>