signed char use_ssl; /* ssl enabled (1: on, 0: disabled, -1 forced off) */
unsigned int flags; /* server flags (SRV_F_*) */
unsigned int pp_opts; /* proxy protocol options (SRV_PP_*) */
- struct mt_list global_list; /* attach point in the global servers */
+ struct list global_list; /* attach point in the global servers */
struct list el_px; /* attach point in parent proxy */
int cklen; /* the len of the cookie, to speed up checks */
int rdr_len; /* the length of the redirection prefix */
extern struct idle_conns idle_conns[MAX_THREADS];
extern struct task *idle_conn_task[MAX_THREADS];
extern struct eb_root idle_conn_srv[MAX_THREADS];
-extern struct mt_list all_servers;
+extern struct list all_servers;
extern struct dict server_key_dict;
int srv_downtime(const struct server *s);
struct proxy *px = srv->proxy;
LIST_DEL_INIT(&srv->el_px);
+
+ if (global.mode & MODE_STARTING) {
+ /* Necessary if startup is interrupted due to an early error before check_config_validity(). */
+ LIST_DEL_INIT(&srv->global_list);
+ }
+
/* Reset the proxy's ready_srv if it was this one. */
HA_ATOMIC_CAS(&px->ready_srv, &srv, NULL);
}
struct proxy *defpx;
struct list *init_proxies_list = NULL;
struct stktable *t;
- struct server *newsrv = NULL, *defsrv;
- struct mt_list back;
+ struct server *newsrv = NULL, *tmpsrv, *defsrv;
int err_code = 0;
/* Value forced to skip '1' due to an historical bug, see below for more details. */
unsigned int next_pxid = 2;
* we must finish to initialize certain things on the servers,
* as some of the fields may be accessed soon
*/
- MT_LIST_FOR_EACH_ENTRY_LOCKED(newsrv, &all_servers, global_list, back) {
+ list_for_each_entry_safe(newsrv, tmpsrv, &all_servers, global_list) {
err_code |= srv_preinit(newsrv);
if (err_code & ERR_CODE)
goto out;
+ LIST_DEL_INIT(&newsrv->global_list);
}
list_for_each_entry(defpx, &defaults_list, el) {
if (srv_preinit(srv))
goto leave;
+
+ /* No need to stay in <all_servers> as srv_preinit() is manually called. */
+ LIST_DEL_INIT(&srv->global_list);
+
#if 0
/* XXX Must this be done? XXX */
if (!srv_alloc_lb(srv, &hld_proxy)) {
struct eb_root idle_conn_srv[MAX_THREADS];
struct task *idle_conn_task[MAX_THREADS] __read_mostly = {};
-struct mt_list all_servers = MT_LIST_HEAD_INIT(all_servers);
+struct list all_servers = LIST_HEAD_INIT(all_servers);
static struct task *server_atomic_sync_task = NULL;
static event_hdl_async_equeue server_atomic_sync_queue;
}
}
-/* Allocates a server, attaches it to the global <all_servers> list
- * and adds it to <proxy> server list. Before deleting the server with
- * srv_drop(), srv_detach() must be called to remove it from the parent
- * proxy list
+/* Allocates a server and adds it to <proxy> server list. Before deleting the
+ * server with srv_drop(), srv_detach() must be called to remove it from the
+ * parent proxy list
*
* Returns the server on success, otherwise NULL.
*/
srv->obj_type = OBJ_TYPE_SERVER;
srv->proxy = proxy;
LIST_APPEND(&proxy->servers, &srv->el_px);
- MT_LIST_APPEND(&all_servers, &srv->global_list);
LIST_INIT(&srv->srv_rec_item);
LIST_INIT(&srv->ip_rec_item);
LIST_INIT(&srv->pp_tlvs);
HA_RWLOCK_INIT(&srv->path_params.param_lock);
+ LIST_INIT(&srv->global_list);
+ if (global.mode & MODE_STARTING)
+ LIST_APPEND(&all_servers, &srv->global_list);
+
return srv;
}
HA_SPIN_DESTROY(&srv->lock);
- MT_LIST_DELETE(&srv->global_list);
event_hdl_sub_list_destroy(&srv->e_subs);
srv_free(&srv);
if (srv_preinit(srv) & ERR_CODE)
goto error;
+ /* No need to stay in <all_servers> as srv_preinit() is manually called. */
+ LIST_DEL_INIT(&srv->global_list);
+
/* Same thing for the forward proxy: check_config_validity() has
* already walked over sink_proxies_list, so this one is never
* initialized nor finalized. Keep the same order as there, as the