diff --git a/include/haproxy/proxy.h b/include/haproxy/proxy.h index a4ba4be58..973f1a8ad 100644 --- a/include/haproxy/proxy.h +++ b/include/haproxy/proxy.h @@ -67,7 +67,6 @@ struct proxy *proxy_find_best_match(int cap, const char *name, int id, int *diff int proxy_cfg_ensure_no_http(struct proxy *curproxy); int proxy_cfg_ensure_no_log(struct proxy *curproxy); void init_new_proxy(struct proxy *p); -void proxy_preset_defaults(struct proxy *defproxy); void proxy_free_defaults(struct proxy *defproxy); void proxy_destroy_defaults(struct proxy *px); void proxy_destroy_all_unref_defaults(void); diff --git a/src/proxy.c b/src/proxy.c index e4e32a2a1..1d4bbf413 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -1491,9 +1491,9 @@ int proxy_cfg_ensure_no_log(struct proxy *curproxy) return 0; } -/* Perform the most basic initialization of a proxy : - * memset(), list_init(*), reset_timeouts(*). - * Any new proxy or peer should be initialized via this function. +/* Perform the most basic initialization of
proxy and define some common
+ * default parameters values. Any new proxy or peer should be initialized via
+ * this function.
*/
void init_new_proxy(struct proxy *p)
{
@@ -1551,8 +1551,26 @@ void init_new_proxy(struct proxy *p)
HA_RWLOCK_INIT(&p->lock);
- /* initialize the default settings */
- proxy_preset_defaults(p);
+ lf_expr_init(&p->logformat);
+ lf_expr_init(&p->logformat_sd);
+ lf_expr_init(&p->format_unique_id);
+ lf_expr_init(&p->logformat_error);
+
+ /* initialize parameters to common default values */
+ p->mode = PR_MODE_TCP;
+ p->options |= PR_O_REUSE_SAFE;
+ p->max_out_conns = MAX_SRV_LIST;
+ p->email_alert.level = LOG_ALERT;
+ p->load_server_state_from_file = PR_SRV_STATE_FILE_UNSPEC;
+
+ if (!(p->cap & PR_CAP_INT)) {
+ p->maxconn = cfg_maxpconn;
+ p->conn_retries = CONN_RETRIES;
+ }
+ else {
+ p->options2 |= PR_O2_INDEPSTR;
+ p->timeout.connect = 5000;
+ }
}
/* Initialize per-thread proxy fields */
@@ -1567,37 +1585,9 @@ int proxy_init_per_thr(struct proxy *px)
return 0;
}
-/* Preset default settings onto proxy