Klaus Demo nginx / c340a28
delete level event of appropriate type, this should fix select()'s EBADF, WSAENOTSOCK, and "select ready != events" alerts Igor Sysoev 13 years ago
1 changed file(s) with 17 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
767767 int n;
768768 char buf[1];
769769 ngx_err_t err;
770 ngx_int_t event;
770771 ngx_connection_t *c;
771772 ngx_http_upstream_t *u;
772773
778779 u = r->upstream;
779780
780781 if (c->error) {
782 if ((ngx_event_flags & NGX_USE_LEVEL_EVENT) && ev->active) {
783
784 event = ev->write ? NGX_WRITE_EVENT : NGX_READ_EVENT;
785
786 if (ngx_del_event(ev, event, 0) != NGX_OK) {
787 ngx_http_upstream_finalize_request(r, u,
788 NGX_HTTP_INTERNAL_SERVER_ERROR);
789 return;
790 }
791 }
792
781793 if (!u->cacheable) {
782794 ngx_http_upstream_finalize_request(r, u,
783795 NGX_HTTP_CLIENT_CLOSED_REQUEST);
784796 }
797
785798 return;
786799 }
787800
835848 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ev->log, err,
836849 "http upstream recv(): %d", n);
837850
838 /*
839 * we do not need to disable the write event because
840 * that event has NGX_USE_CLEAR_EVENT type
841 */
842
843851 if (ev->write && (n >= 0 || err == NGX_EAGAIN)) {
844852 return;
845853 }
846854
847855 if ((ngx_event_flags & NGX_USE_LEVEL_EVENT) && ev->active) {
848 if (ngx_del_event(ev, NGX_READ_EVENT, 0) == NGX_ERROR) {
856
857 event = ev->write ? NGX_WRITE_EVENT : NGX_READ_EVENT;
858
859 if (ngx_del_event(ev, event, 0) != NGX_OK) {
849860 ngx_http_upstream_finalize_request(r, u,
850861 NGX_HTTP_INTERNAL_SERVER_ERROR);
851862 return;