hello!
These days, I am studying the nginx source code..
I think this code is very beautiful.
But there is a question.
If there is some coming event : #1, #2,#3 .. #40, ,
When we deal with #1, #40 will shut down and it's variables instance is 0
and #2.#3 is a new connection,
Accept function to allocate a new descriptor which is just free (#40),
when we deal with #2,
we need to invoke function named ngx_event_accept, and then invoke
ngx_get_connection,
but unfortunately after that ,we failed which mean we need to free
connection,but we have invoked ngx_get_connection once which means variables
instance have changed once.
when we deal with #3,we success, the fd set to 40, and the value of instance is
changed again.
Now it's the same with before, so the following Judgment statement in the
function named ngx_epoll_process_events will not work,
if (c->fd == -1 || rev->instance != instance) {
/*
* the stale event from a file descriptor
* that was just closed in this iteration
*/
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"epoll: stale event %p", c);
continue;
}
I know it can post event not handle,but if i don't use
ngx_use_accept_mutex,which means the flag in function
ngx_process_events_and_timers doesn't include NGX_POST_EVENTS,
in this case,it will not post event but handle event immediately and it's
wrong because #40 is stale event.
I'm looking forward to your early reply.
Thank you!
_______________________________________________
nginx-devel mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx-devel