int tcp_ut; /* for TCP, user timeout */
int maxaccept; /* if set, max number of connections accepted at once (-1 when disabled) */
unsigned int backlog; /* if set, listen backlog */
+ int maxconn; /* maximum connections allowed on this listener */
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 */
struct fe_counters *counters; /* statistics counters */
int nbconn; /* current number of connections on this listener */
- int maxconn; /* maximum connections allowed on this listener */
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 */
/* helper to get listener status for stats */
enum li_status get_li_status(struct listener *l)
{
- if (!l->maxconn || l->nbconn < l->maxconn) {
+ if (!l->bind_conf->maxconn || l->nbconn < l->bind_conf->maxconn) {
if (l->state == LI_LIMITED)
return LI_STATUS_WAITING;
else
*/
do_unbind_listener(listener);
}
- else if (!listener->maxconn || listener->nbconn < listener->maxconn) {
+ else if (!listener->bind_conf->maxconn || listener->nbconn < listener->bind_conf->maxconn) {
listener->rx.proto->enable(listener);
listener_set_state(listener, LI_READY);
}
if (l->rx.proto->resume)
ret = l->rx.proto->resume(l);
- if (l->maxconn && l->nbconn >= l->maxconn) {
+ if (l->bind_conf->maxconn && l->nbconn >= l->bind_conf->maxconn) {
l->rx.proto->disable(l);
listener_set_state(l, LI_FULL);
goto done;
if (l->bind_conf->frontend->backlog)
return l->bind_conf->frontend->backlog;
- if (l->maxconn)
- return l->maxconn;
+ if (l->bind_conf->maxconn)
+ return l->bind_conf->maxconn;
if (l->bind_conf->frontend->maxconn)
return l->bind_conf->frontend->maxconn;
*/
do {
count = l->nbconn;
- if (unlikely(l->maxconn && count >= l->maxconn)) {
+ if (unlikely(l->bind_conf->maxconn && count >= l->bind_conf->maxconn)) {
/* the listener was marked full or another
* thread is going to do it.
*/
if (next_actconn)
_HA_ATOMIC_DEC(&actconn);
- if ((l->state == LI_FULL && (!l->maxconn || l->nbconn < l->maxconn)) ||
+ if ((l->state == LI_FULL && (!l->bind_conf->maxconn || l->nbconn < l->bind_conf->maxconn)) ||
(l->state == LI_LIMITED &&
((!p || p->feconn < p->maxconn) && (actconn < global.maxconn) &&
(!tick_isset(global_listener_queue_task->expire) ||
/* parse the "maxconn" bind keyword */
static int bind_parse_maxconn(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err)
{
- struct listener *l;
int val;
if (!*args[cur_arg + 1]) {
return ERR_ALERT | ERR_FATAL;
}
- list_for_each_entry(l, &conf->listeners, by_bind)
- l->maxconn = val;
-
+ conf->maxconn = val;
return 0;
}