MINOR: server: Constify source server to copy its settings

The source server used to initialize a new server, in srv_settings_cpy() and
sub-functions, is now a constant.

This patch is mandatory to fix a bug.
This commit is contained in:
Christopher Faulet 2022-08-03 11:21:14 +02:00
parent bc6b23813f
commit 0b365e3cb5
1 changed files with 4 additions and 5 deletions

View File

@ -2000,8 +2000,7 @@ static void display_parser_err(const char *file, int linenum, char **args, int c
ha_alert("%s%s%s%s.\n", msg, quote, token, quote);
}
static void srv_conn_src_sport_range_cpy(struct server *srv,
struct server *src)
static void srv_conn_src_sport_range_cpy(struct server *srv, const struct server *src)
{
int range_sz;
@ -2022,7 +2021,7 @@ static void srv_conn_src_sport_range_cpy(struct server *srv,
/*
* Copy <src> server connection source settings to <srv> server everything needed.
*/
static void srv_conn_src_cpy(struct server *srv, struct server *src)
static void srv_conn_src_cpy(struct server *srv, const struct server *src)
{
srv->conn_src.opts = src->conn_src.opts;
srv->conn_src.source_addr = src->conn_src.source_addr;
@ -2048,7 +2047,7 @@ static void srv_conn_src_cpy(struct server *srv, struct server *src)
* everything needed.
*/
#if defined(USE_OPENSSL)
static void srv_ssl_settings_cpy(struct server *srv, struct server *src)
static void srv_ssl_settings_cpy(struct server *srv, const struct server *src)
{
/* <src> is the current proxy's default server and SSL is enabled */
BUG_ON(src->ssl_ctx.ctx != NULL); /* the SSL_CTX must never be initialized in a default-server */
@ -2170,7 +2169,7 @@ int srv_prepare_for_resolution(struct server *srv, const char *hostname)
* <srv_tmpl> distinguishes these two cases (must be 1 if <srv> is a template,
* 0 if not).
*/
static void srv_settings_cpy(struct server *srv, struct server *src, int srv_tmpl)
static void srv_settings_cpy(struct server *srv, const struct server *src, int srv_tmpl)
{
/* Connection source settings copy */
srv_conn_src_cpy(srv, src);