From 155e6584df48dcd10d28a67585834f034b383641 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 18 Sep 2007 18:36:05 +0200 Subject: [PATCH] [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. --- src/proto_http.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/proto_http.c b/src/proto_http.c index 7a86d1159..3d83a1160 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;