Why does ngx_epoll_del_event use EPOLL_CTL_MOD

Qiying Wang qiyingwangwqy at gmail.com
Mon Oct 28 07:51:43 UTC 2019

Sorry for bothering you.

I think I've made it clear.

Because there's another function ngx_epoll_add_connection which add an
event combined with EPOLLIN & EPOLLOUT. If using ngx_epoll_del_event on
this kind of event it cannot just use EPOLL_CTL_DEL, in which way both the
read and write will be delete. That's why the EPOLL_CTL_MOD was used here.

There's another piece of code in the ignored parts of the code I previously
quoted. Which means when deleting a read event, set it to write event and
modify it, while when deleting a write event, set it to read event and
modify it.

    if (event == NGX_READ_EVENT) {
        e = c->write;
        prev = EPOLLOUT;

    } else {
        e = c->read;
        prev = EPOLLIN|EPOLLRDHUP;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20191028/70a68892/attachment.htm>

More information about the nginx-devel mailing list