char buf[VAR_ARRAY]; /* copy of the beginning of the message for bufsize bytes */
};
+/* Each proxy will have one occurence of this structure per thread group */
+struct proxy_per_tgroup {
+ struct queue queue;
+} THREAD_ALIGNED(64);
+
struct proxy {
enum obj_type obj_type; /* object type == OBJ_TYPE_PROXY */
char flags; /* bit field PR_FL_* */
char *id, *desc; /* proxy id (name) and description */
struct queue queue; /* queued requests (pendconns) */
+ struct proxy_per_tgroup *per_tgrp; /* array of per-tgroup stuff such as queues */
+ unsigned int queueslength; /* Sum of the length of each queue */
int totpend; /* total number of pending connections on this instance (for stats) */
unsigned int feconn, beconn; /* # of active frontend and backends streams */
unsigned int fe_sps_lim; /* limit on new sessions per second on the frontend */
int resolve_stick_rule(struct proxy *curproxy, struct sticking_rule *mrule);
void free_stick_rules(struct list *rules);
void free_server_rules(struct list *srules);
+int proxy_init_per_thr(struct proxy *px);
/*
* This function returns a string containing the type of the proxy in a format
struct listener *listener;
unsigned int next_id;
+ proxy_init_per_thr(curproxy);
/* Configure SSL for each bind line.
* Note: if configuration fails at some point, the ->ctx member
* remains NULL so that listeners can later detach.
conf->agent->fe.timeout.client = TICK_ETERNITY;
conf->agent->fe.fe_req_ana = AN_REQ_SWITCHING_RULES;
+ proxy_init_per_thr(&conf->agent->fe);
+
conf->agent->engine_id = generate_pseudo_uuid();
if (conf->agent->engine_id == NULL)
return -1;
stktable_deinit(p->table);
ha_free(&p->table);
+ ha_free(&p->per_tgrp);
HA_RWLOCK_DESTROY(&p->lbprm.lock);
HA_RWLOCK_DESTROY(&p->lock);
proxy_preset_defaults(p);
}
+/* Initialize per-thread proxy fields */
+int proxy_init_per_thr(struct proxy *px)
+{
+ int i;
+
+ px->per_tgrp = calloc(global.nbtgroups, sizeof(*px->per_tgrp));
+ for (i = 0; i < global.nbtgroups; i++)
+ queue_init(&px->per_tgrp[i].queue, px, NULL);
+
+ return 0;
+}
+
/* Preset default settings onto proxy <defproxy>. */
void proxy_preset_defaults(struct proxy *defproxy)
{