#define LI_O_TCP_L5_RULES 0x0020 /* run TCP L5 rules checks on the incoming session */
/* unused 0x0040 */
/* unused 0x0080 */
-#define LI_O_UNLIMITED 0x0100 /* listener not subject to global limits (peers & stats socket) */
+/* unused 0x0100 */
/* unused 0x0200 */
/* unused 0x0400 */
/* unused 0x0800 */
/* unused 0x1000 */
/* unused 0x2000 */
/* unused 0x4000 */
-#define LI_O_NOSTOP 0x8000 /* keep the listener active even after a soft stop */
+/* unused 0x8000 */
-/* Note: if a listener uses LI_O_UNLIMITED, it is highly recommended that it adds its own
+/* Note: if a bind_conf uses BC_O_UNLIMITED, it is highly recommended that it adds its own
* maxconn setting to the global.maxsock value so that its resources are reserved.
*/
#define BC_O_TCP_FO 0x00000400 /* enable TCP Fast Open (linux >= 3.7) */
#define BC_O_ACC_PROXY 0x00000800 /* find the proxied address in the first request line */
#define BC_O_ACC_CIP 0x00001000 /* find the proxied address in the NetScaler Client IP header */
+#define BC_O_UNLIMITED 0x00002000 /* listeners not subject to global limits (peers & stats socket) */
+#define BC_O_NOSTOP 0x00004000 /* keep the listeners active even after a soft stop */
/* flags used with bind_conf->ssl_options */
struct peer *newpeer = NULL;
const char *err;
struct bind_conf *bind_conf;
- struct listener *l;
int err_code = 0;
char *errmsg = NULL;
static int bind_line, peer_line;
bind_conf->maxaccept = 1;
bind_conf->accept = session_accept_fd;
+ bind_conf->options |= BC_O_UNLIMITED; /* don't make the peers subject to global limits */
if (*args[0] == 'b') {
struct listener *l;
err_code |= ERR_FATAL;
goto out;
}
+
/*
* Newly allocated listener is at the end of the list
*/
l = LIST_ELEM(bind_conf->listeners.p, typeof(l), by_bind);
- l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
+
global.maxsock++; /* for the listening socket */
bind_line = 1;
bind_conf->maxaccept = 1;
bind_conf->accept = session_accept_fd;
+ bind_conf->options |= BC_O_UNLIMITED; /* don't make the peers subject to global limits */
if (!LIST_ISEMPTY(&bind_conf->listeners)) {
ha_alert("parsing [%s:%d] : One listener per \"peers\" section is authorized but another is already configured at [%s:%d].\n", file, linenum, bind_conf->file, bind_conf->line);
goto out;
}
- /*
- * Newly allocated listener is at the end of the list
- */
- l = LIST_ELEM(bind_conf->listeners.p, typeof(l), by_bind);
- l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
global.maxsock++; /* for the listening socket */
}
else if (strcmp(args[0], "shards") == 0) {
bind_conf->accept = session_accept_fd;
bind_conf->nice = -64; /* we want to boost priority for local stats */
+ bind_conf->options |= BC_O_UNLIMITED; /* don't make the peers subject to global limits */
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
- l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
global.maxsock++; /* for the listening socket */
}
}
bind_conf->accept = session_accept_fd;
bind_conf->nice = -64; /* we want to boost priority for local stats */
+ bind_conf->options |= BC_O_UNLIMITED; /* don't make the peers subject to global limits */
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
- /* don't make the peers subject to global limits and don't close it in the master */
- l->options |= LI_O_UNLIMITED;
l->rx.flags |= RX_F_MWORKER; /* we are keeping this FD in the master */
global.maxsock++; /* for the listening socket */
}
bind_conf->accept = session_accept_fd;
bind_conf->nice = -64; /* we want to boost priority for local stats */
+ bind_conf->options |= BC_O_UNLIMITED | BC_O_NOSTOP;
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
- l->options |= (LI_O_UNLIMITED | LI_O_NOSTOP);
HA_ATOMIC_INC(&unstoppable_jobs);
/* it's a sockpair but we don't want to keep the fd in the master */
l->rx.flags &= ~RX_F_INHERITED;
* may only be done once l->bind_conf->accept() has accepted the
* connection.
*/
- if (!(li->options & LI_O_UNLIMITED)) {
+ if (!(li->bind_conf->options & BC_O_UNLIMITED)) {
HA_ATOMIC_UPDATE_MAX(&global.sps_max,
update_freq_ctr(&global.sess_per_sec, 1));
if (li->bind_conf && li->bind_conf->options & BC_O_USE_SSL) {
{
struct proxy *px = l->bind_conf->frontend;
- if (l->options & LI_O_NOSTOP) {
+ if (l->bind_conf->options & BC_O_NOSTOP) {
/* master-worker sockpairs are never closed but don't count as a
* job.
*/
*/
max_accept = l->bind_conf->maxaccept ? l->bind_conf->maxaccept : 1;
- if (!(l->options & LI_O_UNLIMITED) && global.sps_lim) {
+ if (!(l->bind_conf->options & BC_O_UNLIMITED) && global.sps_lim) {
int max = freq_ctr_remain(&global.sess_per_sec, global.sps_lim, 0);
if (unlikely(!max)) {
max_accept = max;
}
- if (!(l->options & LI_O_UNLIMITED) && global.cps_lim) {
+ if (!(l->bind_conf->options & BC_O_UNLIMITED) && global.cps_lim) {
int max = freq_ctr_remain(&global.conn_per_sec, global.cps_lim, 0);
if (unlikely(!max)) {
max_accept = max;
}
#ifdef USE_OPENSSL
- if (!(l->options & LI_O_UNLIMITED) && global.ssl_lim &&
+ if (!(l->bind_conf->options & BC_O_UNLIMITED) && global.ssl_lim &&
l->bind_conf && l->bind_conf->options & BC_O_USE_SSL) {
int max = freq_ctr_remain(&global.ssl_per_sec, global.ssl_lim, 0);
} while (!_HA_ATOMIC_CAS(&p->feconn, &count, next_feconn));
}
- if (!(l->options & LI_O_UNLIMITED)) {
+ if (!(l->bind_conf->options & BC_O_UNLIMITED)) {
do {
count = actconn;
if (unlikely(count >= global.maxconn)) {
_HA_ATOMIC_DEC(&l->nbconn);
if (p)
_HA_ATOMIC_DEC(&p->feconn);
- if (!(l->options & LI_O_UNLIMITED))
+ if (!(l->bind_conf->options & BC_O_UNLIMITED))
_HA_ATOMIC_DEC(&actconn);
continue;
proxy_inc_fe_conn_ctr(l, p);
}
- if (!(l->options & LI_O_UNLIMITED)) {
+ if (!(l->bind_conf->options & BC_O_UNLIMITED)) {
count = update_freq_ctr(&global.conn_per_sec, 1);
HA_ATOMIC_UPDATE_MAX(&global.cps_max, count);
}
* may only be done once l->bind_conf->accept() has accepted the
* connection.
*/
- if (!(l->options & LI_O_UNLIMITED)) {
+ if (!(l->bind_conf->options & BC_O_UNLIMITED)) {
count = update_freq_ctr(&global.sess_per_sec, 1);
HA_ATOMIC_UPDATE_MAX(&global.sps_max, count);
}
#ifdef USE_OPENSSL
- if (!(l->options & LI_O_UNLIMITED) &&
+ if (!(l->bind_conf->options & BC_O_UNLIMITED) &&
l->bind_conf && l->bind_conf->options & BC_O_USE_SSL) {
count = update_freq_ctr(&global.ssl_per_sec, 1);
HA_ATOMIC_UPDATE_MAX(&global.ssl_max, count);
{
struct proxy *fe = l->bind_conf->frontend;
- if (!(l->options & LI_O_UNLIMITED))
+ if (!(l->bind_conf->options & BC_O_UNLIMITED))
_HA_ATOMIC_DEC(&actconn);
if (fe)
_HA_ATOMIC_DEC(&fe->feconn);