aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/unix/ngx_channel.c')
-rw-r--r--src/os/unix/ngx_channel.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/os/unix/ngx_channel.c b/src/os/unix/ngx_channel.c
index 01416d6ab..694b1d83c 100644
--- a/src/os/unix/ngx_channel.c
+++ b/src/os/unix/ngx_channel.c
@@ -205,7 +205,7 @@ ngx_int_t ngx_add_channel_event(ngx_cycle_t *cycle, ngx_fd_t fd,
ev->event_handler = handler;
- if (ngx_add_conn) {
+ if (ngx_add_conn && (ngx_event_flags & NGX_USE_EPOLL_EVENT) == 0) {
if (ngx_add_conn(c) == NGX_ERROR) {
return NGX_ERROR;
}
@@ -218,3 +218,15 @@ ngx_int_t ngx_add_channel_event(ngx_cycle_t *cycle, ngx_fd_t fd,
return NGX_OK;
}
+
+
+void ngx_close_channel(ngx_fd_t *fd, ngx_log_t *log)
+{
+ if (close(fd[0]) == -1) {
+ ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, "close() failed");
+ }
+
+ if (close(fd[1]) == -1) {
+ ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, "close() failed");
+ }
+}