/* second cache line */
struct wait_event *subs; /* Task to wake when awaited events are ready */
union {
- struct list idle_list; /* list element for idle connection in server idle list */
- struct mt_list toremove_list; /* list element when idle connection is ready to be purged */
- };
- union {
- struct list sess_el; /* used by private backend conns, list elem into session */
- struct list stopping_list; /* used by frontend conns, attach point in mux stopping list */
+ /* Backend connections only */
+ struct {
+ struct mt_list toremove_list; /* list element when idle connection is ready to be purged */
+ struct list idle_list; /* list element for idle connection in server idle list */
+ struct list sess_el; /* used by private connections, list elem into session */
+ };
+ /* Frontend connections only */
+ struct list stopping_list; /* attach point in mux stopping list */
};
union conn_handle handle; /* connection handle at the socket layer */
const struct netns_entry *proxy_netns;
conn->target = target;
conn->destroy_cb = NULL;
conn->proxy_netns = NULL;
- MT_LIST_INIT(&conn->toremove_list);
- if (conn_is_back(conn))
- LIST_INIT(&conn->sess_el);
- else
- LIST_INIT(&conn->stopping_list);
LIST_INIT(&conn->tlv_list);
conn->subs = NULL;
conn->src = NULL;
*/
static int conn_backend_init(struct connection *conn)
{
+ LIST_INIT(&conn->idle_list);
+ LIST_INIT(&conn->sess_el);
+ MT_LIST_INIT(&conn->toremove_list);
+
if (!sockaddr_alloc(&conn->dst, 0, 0))
return 1;
return 0;
}
+/* Initialize members used only on frontend connections. */
+static void conn_frontend_init(struct connection *conn)
+{
+ LIST_INIT(&conn->stopping_list);
+}
+
/* Release connection elements reserved for backend side usage. It also takes
* care to detach it if linked to a session or a server instance.
*
return NULL;
}
}
+ else {
+ conn_frontend_init(conn);
+ }
return conn;
}
conn_backend_deinit(conn);
+ conn_frontend_init(conn);
conn->target = &l->obj_type;
conn->flags |= CO_FL_ACT_REVERSING;
task_wakeup(l->rx.rhttp.task, TASK_WOKEN_RES);