Proposal minor patch on ngx_http_upstream.c
crespin
nginx-forum at nginx.us
Fri Aug 8 06:49:13 UTC 2014
Hello,
Here is the corresponding patch.
Regards,
yves
# HG changeset patch
# User Yves Crespin<yves.crespin at e-quartz.fr>
# Date 1407480323 -7200
# Node ID a62fffc16af816612a4acf34c7a4781f454fa5d1
# Parent 8120c2937062998497546a3ecb38b78bb302fe34
Upstream: ngx_socket_errno can only be used if |recv()| failed
if |recv()| is a success, err will have a random value.
only debug message are impacted.
diff -r 8120c2937062 -r a62fffc16af8 src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c Thu Aug 07 16:04:07 2014 +0200
+++ b/src/http/ngx_http_upstream.c Fri Aug 08 08:45:23 2014 +0200
@@ -1145,7 +1145,7 @@
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);
@@ -1175,9 +1175,6 @@
}
ev->error = 1;
-
- } else { /* n == 0 */
- err = 0;
}
ev->eof = 1;
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,250570,252403#msg-252403
More information about the nginx
mailing list