comparison src/http/ngx_http_upstream.c @ 4915:e62219793beb

Upstream: better detection of connect() failures with kqueue. Pending EOF might be reported on both read and write events, whichever comes first, so check both of them. Patch by Yichun Zhang (agentzh), slightly modified.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 16 Nov 2012 18:29:19 +0000
parents 508e61393b6c
children 79c8e87b1fcb
comparison
equal deleted inserted replaced
4914:dcb853acae97 4915:e62219793beb
1807 socklen_t len; 1807 socklen_t len;
1808 1808
1809 #if (NGX_HAVE_KQUEUE) 1809 #if (NGX_HAVE_KQUEUE)
1810 1810
1811 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { 1811 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
1812 if (c->write->pending_eof) { 1812 if (c->write->pending_eof || c->read->pending_eof) {
1813 if (c->write->pending_eof) {
1814 err = c->write->kq_errno;
1815
1816 } else {
1817 err = c->read->kq_errno;
1818 }
1819
1813 c->log->action = "connecting to upstream"; 1820 c->log->action = "connecting to upstream";
1814 (void) ngx_connection_error(c, c->write->kq_errno, 1821 (void) ngx_connection_error(c, err,
1815 "kevent() reported that connect() failed"); 1822 "kevent() reported that connect() failed");
1816 return NGX_ERROR; 1823 return NGX_ERROR;
1817 } 1824 }
1818 1825
1819 } else 1826 } else