}
l = LIST_ELEM(bind_conf->listeners.n, typeof(l), by_bind);
l->maxaccept = 1;
- l->maxconn = curpeers->peers_fe->maxconn;
l->accept = session_accept_fd;
l->analysers |= curpeers->peers_fe->fe_req_ana;
l->default_target = curpeers->peers_fe->default_target;
l = LIST_ELEM(bind_conf->listeners.n, typeof(l), by_bind);
l->maxaccept = 1;
- l->maxconn = curpeers->peers_fe->maxconn;
l->accept = session_accept_fd;
l->analysers |= curpeers->peers_fe->fe_req_ana;
l->default_target = curpeers->peers_fe->default_target;
if (curproxy->options & PR_O_TCP_NOLING)
listener->options |= LI_O_NOLINGER;
- if (!listener->maxconn)
- listener->maxconn = curproxy->maxconn;
if (!listener->maxaccept)
listener->maxaccept = global.tune.maxaccept ? global.tune.maxaccept : 64;
}
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
- l->maxconn = global.stats_fe->maxconn;
l->accept = session_accept_fd;
l->default_target = global.stats_fe->default_target;
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
- l->maxconn = 10;
l->accept = session_accept_fd;
l->default_target = mworker_proxy->default_target;
/* don't make the peers subject to global limits and don't close it in the master */
path = NULL;
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
- l->maxconn = global.stats_fe->maxconn;
l->accept = session_accept_fd;
l->default_target = global.stats_fe->default_target;
l->options |= (LI_O_UNLIMITED | LI_O_NOSTOP);
listener->state = LI_LISTEN;
}
}
- else if (listener->nbconn < listener->maxconn) {
+ else if (!listener->maxconn || listener->nbconn < listener->maxconn) {
fd_want_recv(listener->fd);
listener->state = LI_READY;
}
LIST_DEL_LOCKED(&l->wait_queue);
- if (l->nbconn >= l->maxconn) {
+ if (l->maxconn && l->nbconn >= l->maxconn) {
l->state = LI_FULL;
goto end;
}
*/
do {
count = l->nbconn;
- if (count >= l->maxconn) {
+ if (l->maxconn && count >= l->maxconn) {
/* the listener was marked full or another
* thread is going to do it.
*/
next_conn = count + 1;
} while (!HA_ATOMIC_CAS(&l->nbconn, &count, next_conn));
- if (next_conn == l->maxconn) {
+ if (l->maxconn && next_conn == l->maxconn) {
/* we filled it, mark it full */
listener_full(l);
}
if (next_actconn)
HA_ATOMIC_SUB(&actconn, 1);
- if ((l->state == LI_FULL && l->nbconn < l->maxconn) ||
+ if ((l->state == LI_FULL && (!l->maxconn || l->nbconn < l->maxconn)) ||
(l->state == LI_LIMITED && ((!p || p->feconn < p->maxconn) && (actconn < global.maxconn)))) {
/* at least one thread has to this when quitting */
resume_listener(l);
}
val = atol(args[cur_arg + 1]);
- if (val <= 0) {
- memprintf(err, "'%s' : invalid value %d, must be > 0", args[cur_arg], val);
+ if (val < 0) {
+ memprintf(err, "'%s' : invalid value %d, must be >= 0", args[cur_arg], val);
return ERR_ALERT | ERR_FATAL;
}
int peers_init_sync(struct peers *peers)
{
struct peer * curpeer;
- struct listener *listener;
for (curpeer = peers->remote; curpeer; curpeer = curpeer->next) {
peers->peers_fe->maxconn += 3;
}
- list_for_each_entry(listener, &peers->peers_fe->conf.listeners, by_fe)
- listener->maxconn = peers->peers_fe->maxconn;
peers->sync_task = task_new(MAX_THREADS_MASK);
if (!peers->sync_task)
return 0;
px->maxconn = v;
list_for_each_entry(l, &px->conf.listeners, by_fe) {
- l->maxconn = v;
+ if (l->maxconn)
+ l->maxconn = v;
if (l->state == LI_FULL)
resume_listener(l);
}
stats[ST_F_EREQ] = mkf_u64(FN_COUNTER, l->counters->failed_req);
stats[ST_F_DCON] = mkf_u64(FN_COUNTER, l->counters->denied_conn);
stats[ST_F_DSES] = mkf_u64(FN_COUNTER, l->counters->denied_sess);
- stats[ST_F_STATUS] = mkf_str(FO_STATUS, (l->nbconn < l->maxconn) ? (l->state == LI_LIMITED) ? "WAITING" : "OPEN" : "FULL");
+ stats[ST_F_STATUS] = mkf_str(FO_STATUS, (!l->maxconn || l->nbconn < l->maxconn) ? (l->state == LI_LIMITED) ? "WAITING" : "OPEN" : "FULL");
stats[ST_F_PID] = mkf_u32(FO_KEY, relative_pid);
stats[ST_F_IID] = mkf_u32(FO_KEY|FS_SERVICE, px->uuid);
stats[ST_F_SID] = mkf_u32(FO_KEY|FS_SERVICE, l->luid);