Proposal minor patch on ngx_http_upstream.c
crespin
nginx-forum at nginx.us
Mon Jun 2 13:51:42 UTC 2014
Hello,
errno is only set on error, so if |recv()| is a success, |err| will have a
random value.
Only debug message are impacted.
Can you check if it is ok?
Comments are welcome.
Feel free to change the patch.
Regards,
yves
---
nginx-1.6.0/src/http/ngx_http_upstream.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/nginx-1.6.0/src/http/ngx_http_upstream.c
b/nginx-1.6.0/src/http/ngx
index 040bda1..f60acb3 100644
--- a/nginx-1.6.0/src/http/ngx_http_upstream.c
+++ b/nginx-1.6.0/src/http/ngx_http_upstream.c
@@ -1128,7 +1128,7 @@
ngx_http_upstream_check_broken_connection(ngx_http_request_t *r,
n = recv(c->fd, buf, 1, MSG_PEEK);
- err = ngx_socket_errno;
+ err = n == 1 ? ngx_socket_errno : 0;
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ev->log, err,
"http upstream recv(): %d", n);
@@ -1158,9 +1158,6 @@
ngx_http_upstream_check_broken_connection(ngx_http_request_t *r,
}
ev->error = 1;
-
- } else { /* n == 0 */
- err = 0;
}
ev->eof = 1;
--
1.7.10.4
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,250570,250570#msg-250570
More information about the nginx
mailing list