# HG changeset patch # User Maxim Dounin # Date 1463576249 -10800 # Node ID 282448777dc25a0fd8044be3f5682f17ecd77db1 # Parent a01e400dd4a1fdcdc3404f06d0e2ca870e18c125 Events: changed ngx_epoll_test_rdhup() to use existing epollfd. diff --git a/src/event/modules/ngx_epoll_module.c b/src/event/modules/ngx_epoll_module.c --- a/src/event/modules/ngx_epoll_module.c +++ b/src/event/modules/ngx_epoll_module.c @@ -463,17 +463,9 @@ ngx_epoll_notify_handler(ngx_event_t *ev static void ngx_epoll_test_rdhup(ngx_cycle_t *cycle) { - int epfd, s[2], events; + int s[2], events; struct epoll_event ee; - epfd = epoll_create(1); - - if (epfd == -1) { - ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, - "epoll_create() failed"); - return; - } - if (socketpair(AF_UNIX, SOCK_STREAM, 0, s) == -1) { ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, "socketpair() failed"); @@ -482,7 +474,7 @@ ngx_epoll_test_rdhup(ngx_cycle_t *cycle) ee.events = EPOLLET|EPOLLIN|EPOLLRDHUP; - if (epoll_ctl(epfd, EPOLL_CTL_ADD, s[0], &ee) == -1) { + if (epoll_ctl(ep, EPOLL_CTL_ADD, s[0], &ee) == -1) { ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, "epoll_ctl() failed"); return; @@ -494,7 +486,7 @@ ngx_epoll_test_rdhup(ngx_cycle_t *cycle) return; } - events = epoll_wait(epfd, &ee, 1, 5000); + events = epoll_wait(ep, &ee, 1, 5000); if (events == -1) { ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, @@ -503,7 +495,6 @@ ngx_epoll_test_rdhup(ngx_cycle_t *cycle) } (void) close(s[0]); - (void) close(epfd); if (events) { ngx_use_epoll_rdhup = ee.events & EPOLLRDHUP;