Mercurial > hg > nginx
diff src/event/modules/ngx_poll_module.c @ 247:008276b9e061
nginx-0.0.1-2004-02-01-11:10:52 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 01 Feb 2004 08:10:52 +0000 |
parents | 6753e8cdaa2c |
children | e885208c518b |
line wrap: on
line diff
--- a/src/event/modules/ngx_poll_module.c +++ b/src/event/modules/ngx_poll_module.c @@ -261,7 +261,7 @@ static int ngx_poll_process_events(ngx_l return NGX_ERROR; } - if ((int) timer != INFTIM) { + if (timer != (ngx_msec_t) INFTIM) { delta = ngx_elapsed_msec - delta; ngx_log_debug2(NGX_LOG_DEBUG_EVENT, log, 0, @@ -277,6 +277,27 @@ static int ngx_poll_process_events(ngx_l nready = 0; for (i = 0; i < nevents && ready; i++) { + + ngx_log_debug3(NGX_LOG_DEBUG_EVENT, log, 0, + "poll: fd:%d ev:%04X rev:%04X", + event_list[i].fd, + event_list[i].events, event_list[i].revents); + + if (event_list[i].revents & (POLLERR|POLLHUP|POLLNVAL)) { + ngx_log_error(NGX_LOG_ALERT, log, 0, + "poll() error fd:%d ev:%04X rev:%04X", + event_list[i].fd, + event_list[i].events, event_list[i].revents); + } + + if (event_list[i].revents & ~(POLLIN|POLLOUT|POLLERR|POLLHUP|POLLNVAL)) + { + ngx_log_error(NGX_LOG_ALERT, log, 0, + "strange poll() events fd:%d ev:%04X rev:%04X", + event_list[i].fd, + event_list[i].events, event_list[i].revents); + } + c = &ngx_cycle->connections[event_list[i].fd]; if (c->fd == -1) { @@ -293,35 +314,18 @@ static int ngx_poll_process_events(ngx_l } if (c->fd == -1) { - ngx_log_error(NGX_LOG_ALERT, log, 0, "unkonwn cycle"); - exit(1); + ngx_log_error(NGX_LOG_ALERT, log, 0, "unknown cycle"); + continue; } - ngx_log_debug3(NGX_LOG_DEBUG_EVENT, log, 0, - "poll: fd:%d ev:%04X rev:%04X", - event_list[i].fd, - event_list[i].events, event_list[i].revents); - found = 0; - if (event_list[i].revents & POLLNVAL) { - ngx_log_error(NGX_LOG_ALERT, log, EBADF, - "poll() error on %d", event_list[i].fd); - continue; - } - - if (event_list[i].revents & POLLIN - || (event_list[i].revents & (POLLERR|POLLHUP) - && c->read->active)) - { + if (event_list[i].revents & (POLLIN|POLLERR|POLLHUP)) { found = 1; ready_index[nready++] = c->read; } - if (event_list[i].revents & POLLOUT - || (event_list[i].revents & (POLLERR|POLLHUP) - && c->write->active)) - { + if (event_list[i].revents & (POLLOUT|POLLERR|POLLHUP)) { found = 1; ready_index[nready++] = c->write; } @@ -330,13 +334,6 @@ static int ngx_poll_process_events(ngx_l ready--; continue; } - - if (event_list[i].revents & (POLLERR|POLLHUP)) { - ngx_log_error(NGX_LOG_ALERT, log, 0, - "strange poll() error on fd:%d ev:%04X rev:%04X", - event_list[i].fd, - event_list[i].events, event_list[i].revents); - } } for (i = 0; i < nready; i++) {