diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2012-11-16 18:29:19 +0000 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2012-11-16 18:29:19 +0000 |
commit | e1d5455a74521a01a37579fb925ffa7fbe06f57f (patch) | |
tree | ff278bdf48e0cc3be6ff4c65ee56d79d0bb77926 /src | |
parent | 4d0d2b20ac71f6749b2e3a15f28075ec59531c71 (diff) | |
download | nginx-e1d5455a74521a01a37579fb925ffa7fbe06f57f.tar.gz nginx-e1d5455a74521a01a37579fb925ffa7fbe06f57f.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/http/ngx_http_upstream.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 75ef64e55..9a9bfc000 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -1809,9 +1809,16 @@ ngx_http_upstream_test_connect(ngx_connection_t *c) #if (NGX_HAVE_KQUEUE) if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { - if (c->write->pending_eof) { + if (c->write->pending_eof || c->read->pending_eof) { + if (c->write->pending_eof) { + err = c->write->kq_errno; + + } else { + err = c->read->kq_errno; + } + c->log->action = "connecting to upstream"; - (void) ngx_connection_error(c, c->write->kq_errno, + (void) ngx_connection_error(c, err, "kevent() reported that connect() failed"); return NGX_ERROR; } |