From debac11f90f257909595637c8bd9188f0d7f7bde Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Fri, 8 Jan 2021 17:52:35 +0100 Subject: [PATCH] Trying proxy more often --- src/rev_proxy.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/rev_proxy.c b/src/rev_proxy.c index 04c8ebe..0444bbf 100644 --- a/src/rev_proxy.c +++ b/src/rev_proxy.c @@ -16,7 +16,7 @@ int rev_proxy_init(http_req *req, http_res *res, host_config *conf, sock *client char * err_msg) { char buffer[CHUNK_SIZE]; long ret; - int new = 0; + int tries = 0; int retry = 0; if (rev_proxy.socket != 0 && rev_proxy_host == conf->name) { @@ -27,7 +27,7 @@ int rev_proxy_init(http_req *req, http_res *res, host_config *conf, sock *client retry: retry = 0; - new = 1; + tries++; rev_proxy.socket = socket(AF_INET6, SOCK_STREAM, 0); if (rev_proxy.socket < 0) { @@ -104,7 +104,7 @@ int rev_proxy_init(http_req *req, http_res *res, host_config *conf, sock *client res->status = http_get_status(502); print(ERR_STR "Unable to send request to server: %s" CLR_STR, sock_strerror(&rev_proxy)); sprintf(err_msg, "Unable to send request to server: %s.", sock_strerror(&rev_proxy)); - retry = !new; + retry = tries < 4; goto proxy_err; } @@ -121,7 +121,7 @@ int rev_proxy_init(http_req *req, http_res *res, host_config *conf, sock *client res->status = http_get_status(502); print(ERR_STR "Unable to send request to server: %s" CLR_STR, sock_strerror(&rev_proxy)); sprintf(err_msg, "Unable to send request to server: %s.", sock_strerror(&rev_proxy)); - retry = !new; + retry = tries < 4; goto proxy_err; } content_len -= len; @@ -132,7 +132,7 @@ int rev_proxy_init(http_req *req, http_res *res, host_config *conf, sock *client res->status = http_get_status(502); print(ERR_STR "Unable to send request to server: %s" CLR_STR, sock_strerror(&rev_proxy)); sprintf(err_msg, "Unable to send request to server: %s.", sock_strerror(&rev_proxy)); - retry = !new; + retry = tries < 4; goto proxy_err; } } @@ -143,7 +143,7 @@ int rev_proxy_init(http_req *req, http_res *res, host_config *conf, sock *client res->status = http_get_status(502); print(ERR_STR "Unable to receive response from server: %s" CLR_STR, sock_strerror(&rev_proxy)); sprintf(err_msg, "Unable to receive response from server: %s.", sock_strerror(&rev_proxy)); - retry = !new; + retry = tries < 4; goto proxy_err; }