mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
MINOR: proxy: define cap PR_CAP_LUA
Define a new cap PR_CAP_LUA. It can be used to allocate the internal proxy for lua Socket class. This cap overrides default settings for preferable values in the lua context.
This commit is contained in:
parent
27fefa1967
commit
6f26faecd8
@ -68,6 +68,7 @@ enum PR_SRV_STATE_FILE {
|
|||||||
#define PR_CAP_BE 0x0002
|
#define PR_CAP_BE 0x0002
|
||||||
#define PR_CAP_LISTEN (PR_CAP_FE|PR_CAP_BE)
|
#define PR_CAP_LISTEN (PR_CAP_FE|PR_CAP_BE)
|
||||||
#define PR_CAP_DEF 0x0004 /* defaults section */
|
#define PR_CAP_DEF 0x0004 /* defaults section */
|
||||||
|
#define PR_CAP_LUA 0x0008 /* internal proxy used by lua engine */
|
||||||
|
|
||||||
/* bits for proxy->options */
|
/* bits for proxy->options */
|
||||||
#define PR_O_REDISP 0x00000001 /* allow reconnection to dispatch in case of errors */
|
#define PR_O_REDISP 0x00000001 /* allow reconnection to dispatch in case of errors */
|
||||||
|
15
src/proxy.c
15
src/proxy.c
@ -1342,10 +1342,14 @@ void proxy_preset_defaults(struct proxy *defproxy)
|
|||||||
{
|
{
|
||||||
defproxy->mode = PR_MODE_TCP;
|
defproxy->mode = PR_MODE_TCP;
|
||||||
defproxy->disabled = 0;
|
defproxy->disabled = 0;
|
||||||
defproxy->maxconn = cfg_maxpconn;
|
if (!(defproxy->cap & PR_CAP_LUA)) {
|
||||||
defproxy->conn_retries = CONN_RETRIES;
|
defproxy->maxconn = cfg_maxpconn;
|
||||||
|
defproxy->conn_retries = CONN_RETRIES;
|
||||||
|
}
|
||||||
defproxy->redispatch_after = 0;
|
defproxy->redispatch_after = 0;
|
||||||
defproxy->options = PR_O_REUSE_SAFE;
|
defproxy->options = PR_O_REUSE_SAFE;
|
||||||
|
if (defproxy->cap & PR_CAP_LUA)
|
||||||
|
defproxy->options2 |= PR_O2_INDEPSTR;
|
||||||
defproxy->max_out_conns = MAX_SRV_LIST;
|
defproxy->max_out_conns = MAX_SRV_LIST;
|
||||||
|
|
||||||
defproxy->defsrv.check.inter = DEF_CHKINTR;
|
defproxy->defsrv.check.inter = DEF_CHKINTR;
|
||||||
@ -1376,6 +1380,9 @@ void proxy_preset_defaults(struct proxy *defproxy)
|
|||||||
#if defined(USE_QUIC)
|
#if defined(USE_QUIC)
|
||||||
quic_transport_params_init(&defproxy->defsrv.quic_params, 0);
|
quic_transport_params_init(&defproxy->defsrv.quic_params, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (defproxy->cap & PR_CAP_LUA)
|
||||||
|
defproxy->timeout.connect = 5000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Frees all dynamic settings allocated on a default proxy that's about to be
|
/* Frees all dynamic settings allocated on a default proxy that's about to be
|
||||||
@ -1470,7 +1477,9 @@ struct proxy *alloc_new_proxy(const char *name, unsigned int cap, char **errmsg)
|
|||||||
curproxy->last_change = now.tv_sec;
|
curproxy->last_change = now.tv_sec;
|
||||||
curproxy->id = strdup(name);
|
curproxy->id = strdup(name);
|
||||||
curproxy->cap = cap;
|
curproxy->cap = cap;
|
||||||
proxy_store_name(curproxy);
|
|
||||||
|
if (!(cap & PR_CAP_LUA))
|
||||||
|
proxy_store_name(curproxy);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
return curproxy;
|
return curproxy;
|
||||||
|
Loading…
Reference in New Issue
Block a user