Upstream: ignore read-readiness if request wasn't sent.

Change-Id: I95b16fa38d8d859add15e2acf25a83392793f7ee
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Reviewed-on: https://nginx-review.googlesource.com/2921
Reviewed-by: Feng Li <fengli@google.com>
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index fbbc4b4..e7bde16 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2232,8 +2232,12 @@
         return;
     }
 
-    if (!u->request_sent && ngx_http_upstream_test_connect(c) != NGX_OK) {
-        ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
+    if (!u->request_sent) {
+        if (ngx_http_upstream_test_connect(c) != NGX_OK) {
+            ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
+            return;
+        }
+
         return;
     }