Mercurial > hg > nginx-vendor-0-6
diff src/event/modules/ngx_epoll_module.c @ 32:da8c190bdaba NGINX_0_1_16
nginx 0.1.16
*) Bugfix: if the response were transferred by chunks, then on the HEAD
request the final chunk was issued.
*) Bugfix: the "Connection: keep-alive" header were issued, even if the
keepalive_timeout directive forbade the keep-alive use.
*) Bugfix: the errors in the ngx_http_fastcgi_module caused the
segmentation faults.
*) Bugfix: the compressed response encrypted by SSL may not transferred
complete.
*) Bugfix: the TCP-specific TCP_NODELAY, TCP_NOPSUH, and TCP_CORK
options, are not used for the unix domain sockets.
*) Feature: the rewrite directive supports the arguments rewriting.
*) Bugfix: the response code 400 was returned for the POST request with
the "Content-Length: 0" header; bug appeared in 0.1.14.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 25 Jan 2005 00:00:00 +0300 |
parents | e1ada20fc595 |
children | 6cfc63e68377 |
line wrap: on
line diff
--- a/src/event/modules/ngx_epoll_module.c +++ b/src/event/modules/ngx_epoll_module.c @@ -198,37 +198,40 @@ static void ngx_epoll_done(ngx_cycle_t * static int ngx_epoll_add_event(ngx_event_t *ev, int event, u_int flags) { - int op, prev; + int op; + uint32_t events, prev; ngx_event_t *e; ngx_connection_t *c; struct epoll_event ee; c = ev->data; + events = (uint32_t) event; + if (event == NGX_READ_EVENT) { e = c->write; prev = EPOLLOUT; #if (NGX_READ_EVENT != EPOLLIN) - event = EPOLLIN; + events = EPOLLIN; #endif } else { e = c->read; prev = EPOLLIN; #if (NGX_WRITE_EVENT != EPOLLOUT) - event = EPOLLOUT; + events = EPOLLOUT; #endif } if (e->active) { op = EPOLL_CTL_MOD; - event |= prev; + events |= prev; } else { op = EPOLL_CTL_ADD; } - ee.events = event | flags; + ee.events = events | flags; ee.data.u64 = (uintptr_t) c | ev->instance; ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ev->log, 0, @@ -252,14 +255,15 @@ static int ngx_epoll_add_event(ngx_event static int ngx_epoll_del_event(ngx_event_t *ev, int event, u_int flags) { - int op, prev; + int op; + uint32_t prev; ngx_event_t *e; ngx_connection_t *c; struct epoll_event ee; /* - * when the file descriptor is closed the epoll automatically deletes - * it from its queue so we do not need to delete explicity the event + * when the file descriptor is closed, the epoll automatically deletes + * it from its queue, so we do not need to delete explicity the event * before the closing the file descriptor */ @@ -370,6 +374,7 @@ int ngx_epoll_process_events(ngx_cycle_t { int events; size_t n; + uint32_t revents; ngx_int_t instance, i; ngx_uint_t lock, accept_lock, expire; ngx_err_t err; @@ -521,27 +526,40 @@ int ngx_epoll_process_events(ngx_cycle_t log = c->log ? c->log : cycle->log; #endif + revents = event_list[i].events; + ngx_log_debug3(NGX_LOG_DEBUG_EVENT, log, 0, "epoll: fd:%d ev:%04XD d:%p", - c->fd, event_list[i].events, event_list[i].data); + c->fd, revents, event_list[i].data); - if (event_list[i].events & (EPOLLERR|EPOLLHUP)) { + if (revents & (EPOLLERR|EPOLLHUP)) { ngx_log_debug2(NGX_LOG_DEBUG_EVENT, log, 0, "epoll_wait() error on fd:%d ev:%04XD", - c->fd, event_list[i].events); + c->fd, revents); + } + + if (revents & ~(EPOLLIN|EPOLLOUT|EPOLLERR|EPOLLHUP)) { + ngx_log_error(NGX_LOG_ALERT, log, 0, + "strange epoll_wait() events fd:%d ev:%04XD", + c->fd, revents); } - if (event_list[i].events & ~(EPOLLIN|EPOLLOUT|EPOLLERR|EPOLLHUP)) { - ngx_log_error(NGX_LOG_ALERT, log, 0, - "strange epoll_wait() events fd:%d ev:%04XD", - c->fd, event_list[i].events); + if ((revents & (EPOLLERR|EPOLLHUP)) + && (revents & (EPOLLIN|EPOLLOUT)) == 0) + { + /* + * if the error events were returned without EPOLLIN or EPOLLOUT, + * then add these flags to handle the events at least in one + * active handler + */ + + revents |= EPOLLIN|EPOLLOUT; } wev = c->write; - if ((event_list[i].events & (EPOLLOUT|EPOLLERR|EPOLLHUP)) - && wev->active) - { + if ((revents & EPOLLOUT) && wev->active) { + if (ngx_threaded) { wev->posted_ready = 1; ngx_post_event(wev); @@ -564,9 +582,8 @@ int ngx_epoll_process_events(ngx_cycle_t * if the accept event is the last one. */ - if ((event_list[i].events & (EPOLLIN|EPOLLERR|EPOLLHUP)) - && rev->active) - { + if ((revents & EPOLLIN) && rev->active) { + if (ngx_threaded && !rev->accept) { rev->posted_ready = 1;