From: Willy Tarreau Date: Tue, 18 Sep 2007 16:36:05 +0000 (+0200) Subject: [MAJOR] timeouts and retries could be ignored when switching backend X-Git-Tag: v1.3.13~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e4261ee2f6e2704eba05f9aabcb6b86f26ad5a7;p=thirdparty%2Fhaproxy.git [MAJOR] timeouts and retries could be ignored when switching backend When switching from a frontend to a backend, the "retries" parameter was not kept, resulting in the impossibility to reconnect after the first connection failure. This problem was reported and analyzed by Krzysztof Oledzki. While fixing the code, it appeared that some of the backend's timeouts were not updated in the session when using "use_backend" or "default_backend". It seems this had no impact but just in case, it's better to set them as they should have been. --- diff --git a/src/proto_http.c b/src/proto_http.c index 6d71dcd8f5..9fe10392ac 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -1905,6 +1905,11 @@ int process_cli(struct session *t) if (t->be->beconn > t->be->beconn_max) t->be->beconn_max = t->be->beconn; t->be->cum_beconn++; + + /* assign new parameters to the session from the new backend */ + t->rep->rto = t->req->wto = t->be->srvtimeout; + t->req->cto = t->be->contimeout; + t->conn_retries = t->be->conn_retries; t->flags |= SN_BE_ASSIGNED; break; } @@ -1921,6 +1926,11 @@ int process_cli(struct session *t) if (t->be->beconn > t->be->beconn_max) t->be->beconn_max = t->be->beconn; t->be->cum_beconn++; + + /* assign new parameters to the session from the new backend */ + t->rep->rto = t->req->wto = t->be->srvtimeout; + t->req->cto = t->be->contimeout; + t->conn_retries = t->be->conn_retries; t->flags |= SN_BE_ASSIGNED; } } while (t->be != cur_proxy); /* we loop only if t->be has changed */ @@ -4037,6 +4047,7 @@ int apply_filter_to_req_headers(struct session *t, struct buffer *req, struct hd t->rep->rto = t->req->wto = t->be->srvtimeout; t->req->cto = t->be->contimeout; + t->conn_retries = t->be->conn_retries; last_hdr = 1; break; @@ -4157,6 +4168,7 @@ int apply_filter_to_req_line(struct session *t, struct buffer *req, struct hdr_e t->rep->rto = t->req->wto = t->be->srvtimeout; t->req->cto = t->be->contimeout; + t->conn_retries = t->be->conn_retries; done = 1; break;