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 (*accept)(struct connection *conn); /* upper layer's accept() */
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 (*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 */
struct mt_list wait_queue; /* link element to make the listener wait for something (LI_LIMITED) */
}
bind_conf->maxaccept = 1;
+ bind_conf->accept = session_accept_fd;
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->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 */
global.maxsock++; /* for the listening socket */
}
bind_conf->maxaccept = 1;
+ bind_conf->accept = session_accept_fd;
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);
* Newly allocated listener is at the end of the list
*/
l = LIST_ELEM(bind_conf->listeners.p, typeof(l), by_bind);
- 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 */
global.maxsock++; /* for the listening socket */
bind_conf->analysers |= curproxy->fe_req_ana;
if (!bind_conf->maxaccept)
bind_conf->maxaccept = global.tune.maxaccept ? global.tune.maxaccept : MAX_ACCEPT;
+ bind_conf->accept = session_accept_fd;
}
/* adjust this proxy's listeners */
if (curproxy->options & PR_O_TCP_NOLING)
listener->options |= LI_O_NOLINGER;
- /* listener accept callback */
- listener->accept = session_accept_fd;
#ifdef USE_QUIC
- /* override the accept callback for QUIC listeners. */
if (listener->flags & LI_F_QUIC_LISTENER) {
if (!global.cluster_secret) {
diag_no_cluster_secret = 1;
return -1;
}
+ bind_conf->accept = session_accept_fd;
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
- l->accept = session_accept_fd;
l->default_target = global.cli_fe->default_target;
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
l->nice = -64; /* we want to boost priority for local stats */
}
+ bind_conf->accept = session_accept_fd;
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
- 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 */
l->options |= LI_O_UNLIMITED;
}
ha_free(&path);
+ bind_conf->accept = session_accept_fd;
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
- l->accept = session_accept_fd;
l->default_target = global.cli_fe->default_target;
l->options |= (LI_O_UNLIMITED | LI_O_NOSTOP);
HA_ATOMIC_INC(&unstoppable_jobs);
li = __objt_listener(conn->target);
_HA_ATOMIC_INC(&li->thr_conn[tid]);
- ret = li->accept(conn);
+ ret = li->bind_conf->accept(conn);
if (ret <= 0) {
/* connection was terminated by the application */
continue;
}
/* increase the per-process number of cumulated sessions, this
- * may only be done once l->accept() has accepted the connection.
+ * may only be done once l->bind_conf->accept() has accepted the
+ * connection.
*/
if (!(li->options & LI_O_UNLIMITED)) {
HA_ATOMIC_UPDATE_MAX(&global.sps_max,
_HA_ATOMIC_INC(&activity[tid].accepted);
- /* past this point, l->accept() will automatically decrement
+ /* past this point, l->bind_conf->accept() will automatically decrement
* l->nbconn, feconn and actconn once done. Setting next_*conn=0
* allows the error path not to rollback on nbconn. It's more
* convenient than duplicating all exit labels.
local_accept:
_HA_ATOMIC_INC(&l->thr_conn[tid]);
- ret = l->accept(cli_conn);
+ ret = l->bind_conf->accept(cli_conn);
if (unlikely(ret <= 0)) {
/* The connection was closed by stream_accept(). Either
* we just have to ignore it (ret == 0) or it's a critical
}
/* increase the per-process number of cumulated sessions, this
- * may only be done once l->accept() has accepted the connection.
+ * may only be done once l->bind_conf->accept() has accepted the
+ * connection.
*/
if (!(l->options & LI_O_UNLIMITED)) {
count = update_freq_ctr(&global.sess_per_sec, 1);
}
bind_conf->maxaccept = global.tune.maxaccept ? global.tune.maxaccept : MAX_ACCEPT;
+ bind_conf->accept = session_accept_fd;
if (!str2listener(args[1], cfg_log_forward, bind_conf, file, linenum, &errmsg)) {
if (errmsg && *errmsg) {
}
}
list_for_each_entry(l, &bind_conf->listeners, by_bind) {
- l->accept = session_accept_fd;
l->default_target = cfg_log_forward->default_target;
global.maxsock++;
}