update_freq_ctr(&th_ctx->out_32bps, (bytes + 16) / 32);
}
+/* Insert <px> at the front of the global list of visible proxies. This should
+ * only be used during configuration parsing. At runtime, a newly added proxy
+ * should be appended at the end of the list instead.
+ */
+static inline void main_proxies_register(struct proxy *px)
+{
+ px->next = proxies_list;
+ proxies_list = px;
+}
+
#endif /* _HAPROXY_PROXY_H */
/*
curr_defproxy = last_defproxy = curproxy;
} else {
/* regular proxies are in a list */
- curproxy->next = proxies_list;
- proxies_list = curproxy;
+ main_proxies_register(curproxy);
}
goto out;
}
return NULL;
}
- fe->next = proxies_list;
- proxies_list = fe;
+ main_proxies_register(fe);
fe->maxconn = 10; /* default to 10 concurrent connections */
fe->timeout.client = MS_TO_TICKS(10000); /* default timeout of 10 seconds */
fe->conf.file = copy_file_name(file);
/* Does not init the default target the CLI applet, but must be done in
* the request parsing code */
mworker_proxy->default_target = NULL;
- mworker_proxy->next = proxies_list;
- proxies_list = mworker_proxy;
+ main_proxies_register(mworker_proxy);
return 0;
}
hld_proxy.mode = PR_MODE_HTTP;
if (arg_fast)
hld_proxy.options2 = PR_O2_SMARTCON;
- hld_proxy.next = proxies_list;
- proxies_list = &hld_proxy;
+ main_proxies_register(&hld_proxy);
hld_proxy.timeout.server = 60000;
hld_proxy.timeout.connect = 60000;
#endif
/* add the proxy in the proxy list only if everything is successful */
- px->next = proxies_list;
- proxies_list = px;
+ main_proxies_register(px);
if (httpclient_resolve_init(px) != 0) {
memprintf(&errmsg, "cannot initialize resolvers.");
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
- tcpchecks_proxy->next = proxies_list;
- proxies_list = tcpchecks_proxy;
+ main_proxies_register(tcpchecks_proxy);
}
tcpchecks_proxy->options2 &= ~PR_O2_CHK_ANY;
tcpchecks_proxy->tcpcheck.flags = 0;