unsigned int analysers; /* bitmap of required protocol analysers */
int maxseg; /* for TCP, advertised MSS */
int tcp_ut; /* for TCP, user timeout */
+ int maxaccept; /* if set, max number of connections accepted at once (-1 when disabled) */
int level; /* stats access level (ACCESS_LVL_*) */
int severity_output; /* default severity output format in cli feedback messages */
struct list listeners; /* list of listeners using this bind config */
int nbconn; /* current number of connections on this listener */
int maxconn; /* maximum connections allowed on this listener */
unsigned int backlog; /* if set, listen backlog */
- int maxaccept; /* if set, max number of connections accepted at once (-1 when disabled) */
int (*accept)(struct connection *conn); /* upper layer's accept() */
enum obj_type *default_target; /* default target to use for accepted sessions or NULL */
/* cache line boundary */
err_code |= ERR_FATAL;
goto out;
}
+
+ bind_conf->maxaccept = 1;
+
if (*args[0] == 'b') {
struct listener *l;
* Newly allocated listener is at the end of the list
*/
l = LIST_ELEM(bind_conf->listeners.p, typeof(l), by_bind);
- l->maxaccept = 1;
l->accept = session_accept_fd;
l->default_target = curpeers->peers_fe->default_target;
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
goto out;
}
+ bind_conf->maxaccept = 1;
+
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);
err_code |= ERR_FATAL;
* Newly allocated listener is at the end of the list
*/
l = LIST_ELEM(bind_conf->listeners.p, typeof(l), by_bind);
- l->maxaccept = 1;
l->accept = session_accept_fd;
l->default_target = curpeers->peers_fe->default_target;
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
bind_conf->xprt->prepare_bind_conf(bind_conf) < 0)
cfgerr++;
bind_conf->analysers |= curproxy->fe_req_ana;
+ if (!bind_conf->maxaccept)
+ bind_conf->maxaccept = global.tune.maxaccept ? global.tune.maxaccept : MAX_ACCEPT;
}
/* adjust this proxy's listeners */
if (curproxy->options & PR_O_TCP_NOLING)
listener->options |= LI_O_NOLINGER;
- if (!listener->maxaccept)
- listener->maxaccept = global.tune.maxaccept ? global.tune.maxaccept : MAX_ACCEPT;
/* listener accept callback */
listener->accept = session_accept_fd;
p = l->bind_conf->frontend;
- /* if l->maxaccept is -1, then max_accept is UINT_MAX. It is not really
- * illimited, but it is probably enough.
+ /* if l->bind_conf->maxaccept is -1, then max_accept is UINT_MAX. It is
+ * not really illimited, but it is probably enough.
*/
- max_accept = l->maxaccept ? l->maxaccept : 1;
+ max_accept = l->bind_conf->maxaccept ? l->bind_conf->maxaccept : 1;
if (!(l->options & LI_O_UNLIMITED) && global.sps_lim) {
int max = freq_ctr_remain(&global.sess_per_sec, global.sps_lim, 0);
if (!fd_recv_ready(fd))
return;
- max_accept = l->maxaccept ? l->maxaccept : 1;
+ max_accept = l->bind_conf->maxaccept ? l->bind_conf->maxaccept : 1;
do {
/* Source address */
char *message;
size_t size;
- max_accept = l->maxaccept ? l->maxaccept : 1;
+ max_accept = l->bind_conf->maxaccept ? l->bind_conf->maxaccept : 1;
while (co_data(sc_oc(sc))) {
char c;
goto out;
}
+ bind_conf->maxaccept = global.tune.maxaccept ? global.tune.maxaccept : MAX_ACCEPT;
+
if (!str2listener(args[1], cfg_log_forward, bind_conf, file, linenum, &errmsg)) {
if (errmsg && *errmsg) {
indent_msg(&errmsg, 2);
}
}
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
- l->maxaccept = global.tune.maxaccept ? global.tune.maxaccept : MAX_ACCEPT;
l->accept = session_accept_fd;
l->default_target = cfg_log_forward->default_target;
global.maxsock++;
goto out;
}
+ bind_conf->maxaccept = global.tune.maxaccept ? global.tune.maxaccept : MAX_ACCEPT;
+
if (!str2receiver(args[1], cfg_log_forward, bind_conf, file, linenum, &errmsg)) {
if (errmsg && *errmsg) {
indent_msg(&errmsg, 2);
}
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
/* the fact that the sockets are of type dgram is guaranteed by str2receiver() */
- l->maxaccept = global.tune.maxaccept ? global.tune.maxaccept : MAX_ACCEPT;
l->rx.iocb = syslog_fd_handler;
global.maxsock++;
}