conn->mux = NULL;
conn->xprt_st = 0;
conn->xprt_ctx = NULL;
- conn->mux_ctx = NULL;
+ conn->ctx = NULL;
}
/*
conn->tmp_early_data = -1;
conn->sent_early_data = 0;
conn->mux = NULL;
- conn->mux_ctx = NULL;
+ conn->ctx = NULL;
conn->owner = NULL;
conn->send_proxy_ofs = 0;
conn->handle.fd = DEAD_FD_MAGIC;
/* If we temporarily stored the connection as the stream_interface's
* end point, remove it.
*/
- if (conn->mux_ctx != NULL && conn->mux == NULL) {
- struct stream *s = conn->mux_ctx;
+ if (conn->ctx != NULL && conn->mux == NULL) {
+ struct stream *s = conn->ctx;
if (objt_conn(s->si[1].end) == conn)
s->si[1].end = NULL;
void *ctx, struct proxy *prx, struct session *sess)
{
conn->mux = mux;
- conn->mux_ctx = ctx;
+ conn->ctx = ctx;
return mux->init ? mux->init(conn, prx, sess) : 0;
}
const struct xprt_ops *xprt; /* operations at the transport layer */
const struct mux_ops *mux; /* mux layer opreations. Must be set before xprt->init() */
void *xprt_ctx; /* general purpose pointer, initialized to NULL */
- void *mux_ctx; /* mux-specific context, initialized to NULL */
+ void *ctx; /* highest level context (usually the mux), initialized to NULL */
void *owner; /* pointer to the owner session, or NULL */
enum obj_type *target; /* the target to connect to (server, proxy, applet, ...) */
static int conn_complete_server(struct connection *conn)
{
struct conn_stream *cs = NULL;
- struct stream *s = conn->mux_ctx;
+ struct stream *s = conn->ctx;
struct server *srv;
task_wakeup(s->task, TASK_WOKEN_IO);
}
#if defined(USE_OPENSSL) && defined(TLSEXT_TYPE_application_layer_protocol_negotiation)
else {
- srv_conn->mux_ctx = s;
+ srv_conn->ctx = s;
/* Store the connection into the stream interface,
* while we still don't have a mux, so that if the
* stream is destroyed before the connection is
if (fdt.iocb == conn_fd_handler) {
conn_flags = ((struct connection *)fdt.owner)->flags;
mux = ((struct connection *)fdt.owner)->mux;
- ctx = ((struct connection *)fdt.owner)->mux_ctx;
+ ctx = ((struct connection *)fdt.owner)->ctx;
li = objt_listener(((struct connection *)fdt.owner)->target);
sv = objt_server(((struct connection *)fdt.owner)->target);
px = objt_proxy(((struct connection *)fdt.owner)->target);
chunk_appendf(&trash, " fe=%s", li->bind_conf->frontend->id);
if (mux) {
- chunk_appendf(&trash, " mux=%s mux_ctx=%p", mux->name, ctx);
+ chunk_appendf(&trash, " mux=%s ctx=%p", mux->name, ctx);
if (mux->show_fd)
mux->show_fd(&trash, fdt.owner);
}
static int h1_avail_streams(struct connection *conn)
{
- struct h1c *h1c = conn->mux_ctx;
+ struct h1c *h1c = conn->ctx;
return h1c->h1s ? 0 : 1;
}
}
/*
- * Initialize the mux once it's attached. It is expected that conn->mux_ctx
+ * Initialize the mux once it's attached. It is expected that conn->ctx
* points to the existing conn_stream (for outgoing connections) or NULL (for
* incoming ones). Returns < 0 on error.
*/
h1c->flags |= H1C_F_CS_WAIT_CONN;
/* Always Create a new H1S */
- if (!h1s_create(h1c, conn->mux_ctx, sess))
+ if (!h1s_create(h1c, conn->ctx, sess))
goto fail;
- conn->mux_ctx = h1c;
+ conn->ctx = h1c;
/* Try to read, if nothing is available yet we'll just subscribe */
if (h1_recv(h1c))
*/
static void h1_release(struct connection *conn)
{
- struct h1c *h1c = conn->mux_ctx;
+ struct h1c *h1c = conn->ctx;
LIST_DEL(&conn->list);
}
conn->mux = NULL;
- conn->mux_ctx = NULL;
+ conn->ctx = NULL;
conn_stop_tracking(conn);
conn_full_close(conn);
struct connection *conn = h1c->conn;
struct h1s *h1s = h1c->h1s;
- if (!conn->mux_ctx)
+ if (!conn->ctx)
return -1;
if (h1c->flags & H1C_F_CS_WAIT_CONN) {
static void h1_reset(struct connection *conn)
{
- struct h1c *h1c = conn->mux_ctx;
+ struct h1c *h1c = conn->ctx;
/* Reset the flags, and let the mux know we're waiting for a connection */
h1c->flags = H1C_F_CS_WAIT_CONN;
static int h1_wake(struct connection *conn)
{
- struct h1c *h1c = conn->mux_ctx;
+ struct h1c *h1c = conn->ctx;
int ret;
h1_send(h1c);
*/
static struct conn_stream *h1_attach(struct connection *conn, struct session *sess)
{
- struct h1c *h1c = conn->mux_ctx;
+ struct h1c *h1c = conn->ctx;
struct conn_stream *cs = NULL;
struct h1s *h1s;
*/
static const struct conn_stream *h1_get_first_cs(const struct connection *conn)
{
- struct h1c *h1c = conn->mux_ctx;
+ struct h1c *h1c = conn->ctx;
struct h1s *h1s = h1c->h1s;
if (h1s)
static void h1_destroy(struct connection *conn)
{
- struct h1c *h1c = conn->mux_ctx;
+ struct h1c *h1c = conn->ctx;
if (!h1c->h1s)
h1_release(conn);
static void h1_shutw_conn(struct connection *conn)
{
- struct h1c *h1c = conn->mux_ctx;
+ struct h1c *h1c = conn->ctx;
if (conn_xprt_ready(conn) && conn->xprt->shutw)
conn->xprt->shutw(conn, 1);
static int h2_avail_streams(struct connection *conn)
{
- struct h2c *h2c = conn->mux_ctx;
+ struct h2c *h2c = conn->ctx;
/* XXX Should use the negociated max concurrent stream nb instead of the conf value */
return (h2_settings_max_concurrent_streams - h2c->nb_streams);
if (!h2c)
goto fail_no_h2c;
- if (conn->mux_ctx) {
+ if (conn->ctx) {
h2c->flags = H2_CF_IS_BACK;
h2c->shut_timeout = h2c->timeout = prx->timeout.server;
if (tick_isset(prx->timeout.serverfin))
/* FIXME: this is temporary, for outgoing connections we need
* to immediately allocate a stream until the code is modified
* so that the caller calls ->attach(). For now the outgoing cs
- * is stored as conn->mux_ctx by the caller.
+ * is stored as conn->ctx by the caller.
*/
struct h2s *h2s;
- h2s = h2c_bck_stream_new(h2c, conn->mux_ctx, sess);
+ h2s = h2c_bck_stream_new(h2c, conn->ctx, sess);
if (!h2s)
goto fail_stream;
}
- conn->mux_ctx = h2c;
+ conn->ctx = h2c;
/* prepare to read something */
tasklet_wakeup(h2c->wait_event.task);
*/
static void h2_release(struct connection *conn)
{
- struct h2c *h2c = conn->mux_ctx;
+ struct h2c *h2c = conn->ctx;
LIST_DEL(&conn->list);
}
conn->mux = NULL;
- conn->mux_ctx = NULL;
+ conn->ctx = NULL;
conn_stop_tracking(conn);
conn_full_close(conn);
static int h2_wake(struct connection *conn)
{
- struct h2c *h2c = conn->mux_ctx;
+ struct h2c *h2c = conn->ctx;
return (h2_process(h2c));
}
{
struct conn_stream *cs;
struct h2s *h2s;
- struct h2c *h2c = conn->mux_ctx;
+ struct h2c *h2c = conn->ctx;
cs = cs_new(conn);
if (!cs)
*/
static const struct conn_stream *h2_get_first_cs(const struct connection *conn)
{
- struct h2c *h2c = conn->mux_ctx;
+ struct h2c *h2c = conn->ctx;
struct h2s *h2s;
struct eb32_node *node;
*/
static void h2_destroy(struct connection *conn)
{
- struct h2c *h2c = conn->mux_ctx;
+ struct h2c *h2c = conn->ctx;
if (eb_is_empty(&h2c->streams_by_id))
h2_release(h2c->conn);
/* for debugging with CLI's "show fd" command */
static void h2_show_fd(struct buffer *msg, struct connection *conn)
{
- struct h2c *h2c = conn->mux_ctx;
+ struct h2c *h2c = conn->ctx;
struct h2s *h2s = NULL;
struct eb32_node *node;
int fctl_cnt = 0;
conn_full_close(conn);
tasklet_free(ctx->wait_event.task);
conn->mux = NULL;
- conn->mux_ctx = NULL;
+ conn->ctx = NULL;
if (conn->destroy_cb)
conn->destroy_cb(conn);
/* We don't bother unsubscribing here, as we're about to destroy
return NULL;
}
-/* Initialize the mux once it's attached. It is expected that conn->mux_ctx
+/* Initialize the mux once it's attached. It is expected that conn->ctx
* points to the existing conn_stream (for outgoing connections) or NULL (for
* incoming ones, in which case one will be allocated and a new stream will be
* instanciated). Returns < 0 on error.
*/
static int mux_pt_init(struct connection *conn, struct proxy *prx, struct session *sess)
{
- struct conn_stream *cs = conn->mux_ctx;
+ struct conn_stream *cs = conn->ctx;
struct mux_pt_ctx *ctx = pool_alloc(pool_head_pt_ctx);
if (!ctx)
goto fail_free;
}
- conn->mux_ctx = ctx;
+ conn->ctx = ctx;
ctx->cs = cs;
cs->flags |= CS_FL_RCV_MORE;
return 0;
*/
static int mux_pt_wake(struct connection *conn)
{
- struct mux_pt_ctx *ctx = conn->mux_ctx;
+ struct mux_pt_ctx *ctx = conn->ctx;
struct conn_stream *cs = ctx->cs;
int ret = 0;
static struct conn_stream *mux_pt_attach(struct connection *conn, struct session *sess)
{
struct conn_stream *cs;
- struct mux_pt_ctx *ctx = conn->mux_ctx;
+ struct mux_pt_ctx *ctx = conn->ctx;
conn->xprt->unsubscribe(conn, SUB_RETRY_RECV, &ctx->wait_event);
cs = cs_new(conn);
*/
static const struct conn_stream *mux_pt_get_first_cs(const struct connection *conn)
{
- struct mux_pt_ctx *ctx = conn->mux_ctx;
+ struct mux_pt_ctx *ctx = conn->ctx;
struct conn_stream *cs = ctx->cs;
return cs;
/* Destroy the mux and the associated connection, if no longer used */
static void mux_pt_destroy_meth(struct connection *conn)
{
- struct mux_pt_ctx *ctx = conn->mux_ctx;
+ struct mux_pt_ctx *ctx = conn->ctx;
if (!(ctx->cs))
mux_pt_destroy(ctx);
static void mux_pt_detach(struct conn_stream *cs)
{
struct connection *conn = cs->conn;
- struct mux_pt_ctx *ctx = cs->conn->mux_ctx;
+ struct mux_pt_ctx *ctx = cs->conn->ctx;
/* Subscribe, to know if we got disconnected */
if (conn->owner != NULL &&
static int mux_pt_avail_streams(struct connection *conn)
{
- struct mux_pt_ctx *ctx = conn->mux_ctx;
+ struct mux_pt_ctx *ctx = conn->ctx;
return (ctx->cs == NULL ? 1 : 0);
}