mirror of
https://github.com/nginx/nginx.git
synced 2026-10-21 19:41:35 +00:00
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.
This commit is contained in:
parent
4d0d2b20ac
commit
e1d5455a74
1 changed files with 9 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue