diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-02-01 08:10:52 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-02-01 08:10:52 +0000 |
commit | 328af6e8cd26f274bf385cfff3c888725746ea4f (patch) | |
tree | 9d543325432262cde3c248dad0595265bb15feea /src/event/modules/ngx_poll_module.c | |
parent | bbcea6c3d79208d002710734d5f0826e7fc79465 (diff) | |
download | nginx-328af6e8cd26f274bf385cfff3c888725746ea4f.tar.gz nginx-328af6e8cd26f274bf385cfff3c888725746ea4f.zip |
nginx-0.0.1-2004-02-01-11:10:52 import
Diffstat (limited to 'src/event/modules/ngx_poll_module.c')
-rw-r--r-- | src/event/modules/ngx_poll_module.c | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/src/event/modules/ngx_poll_module.c b/src/event/modules/ngx_poll_module.c index 708dbd67a..37c10e361 100644 --- 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_log_t *log) 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_log_t *log) 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_log_t *log) } 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_log_t *log) 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++) { |