diff --git a/include/proto/connection.h b/include/proto/connection.h index 05148bb3d..441b51df0 100644 --- a/include/proto/connection.h +++ b/include/proto/connection.h @@ -520,7 +520,7 @@ static inline void conn_prepare(struct connection *conn, const struct protocol * conn->mux = NULL; conn->xprt_st = 0; conn->xprt_ctx = NULL; - conn->mux_ctx = NULL; + conn->ctx = NULL; } /* @@ -545,7 +545,7 @@ static inline void conn_init(struct connection *conn) 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; @@ -672,8 +672,8 @@ static inline void conn_free(struct connection *conn) /* 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; @@ -823,7 +823,7 @@ static inline int conn_install_mux(struct connection *conn, const struct mux_ops 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; } diff --git a/include/types/connection.h b/include/types/connection.h index 430e92a33..f1fd7a09b 100644 --- a/include/types/connection.h +++ b/include/types/connection.h @@ -429,7 +429,7 @@ struct connection { 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, ...) */ diff --git a/src/backend.c b/src/backend.c index 64bea0ac1..237668cc4 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1057,7 +1057,7 @@ static void assign_tproxy_address(struct stream *s) 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); @@ -1338,7 +1338,7 @@ int connect_server(struct stream *s) } #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 diff --git a/src/cli.c b/src/cli.c index ae419b039..cc377fc57 100644 --- a/src/cli.c +++ b/src/cli.c @@ -897,7 +897,7 @@ static int cli_io_handler_show_fd(struct appctx *appctx) 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); @@ -945,7 +945,7 @@ static int cli_io_handler_show_fd(struct appctx *appctx) 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); } diff --git a/src/mux_h1.c b/src/mux_h1.c index bca47738a..84d8ce5d6 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -204,7 +204,7 @@ static inline void h1_release_buf(struct h1c *h1c, struct buffer *bptr) static int h1_avail_streams(struct connection *conn) { - struct h1c *h1c = conn->mux_ctx; + struct h1c *h1c = conn->ctx; return h1c->h1s ? 0 : 1; } @@ -345,7 +345,7 @@ static const struct cs_info *h1_get_cs_info(struct conn_stream *cs) } /* - * 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. */ @@ -376,10 +376,10 @@ static int h1_init(struct connection *conn, struct proxy *proxy, struct session 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)) @@ -402,7 +402,7 @@ static int h1_init(struct connection *conn, struct proxy *proxy, struct session */ static void h1_release(struct connection *conn) { - struct h1c *h1c = conn->mux_ctx; + struct h1c *h1c = conn->ctx; LIST_DEL(&conn->list); @@ -428,7 +428,7 @@ static void h1_release(struct connection *conn) } conn->mux = NULL; - conn->mux_ctx = NULL; + conn->ctx = NULL; conn_stop_tracking(conn); conn_full_close(conn); @@ -1780,7 +1780,7 @@ static int h1_process(struct h1c * h1c) 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) { @@ -1843,7 +1843,7 @@ static struct task *h1_io_cb(struct task *t, void *ctx, unsigned short status) 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; @@ -1851,7 +1851,7 @@ static void h1_reset(struct connection *conn) static int h1_wake(struct connection *conn) { - struct h1c *h1c = conn->mux_ctx; + struct h1c *h1c = conn->ctx; int ret; h1_send(h1c); @@ -1874,7 +1874,7 @@ static int h1_wake(struct connection *conn) */ 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; @@ -1900,7 +1900,7 @@ static struct conn_stream *h1_attach(struct connection *conn, struct session *se */ 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) @@ -1911,7 +1911,7 @@ static const struct conn_stream *h1_get_first_cs(const struct connection *conn) static void h1_destroy(struct connection *conn) { - struct h1c *h1c = conn->mux_ctx; + struct h1c *h1c = conn->ctx; if (!h1c->h1s) h1_release(conn); @@ -2031,7 +2031,7 @@ static void h1_shutw(struct conn_stream *cs, enum cs_shw_mode mode) 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); diff --git a/src/mux_h2.c b/src/mux_h2.c index 499e4231f..cec3576e2 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -355,7 +355,7 @@ static inline void h2_release_buf(struct h2c *h2c, struct buffer *bptr) 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); @@ -386,7 +386,7 @@ static int h2_init(struct connection *conn, struct proxy *prx, struct session *s 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)) @@ -454,16 +454,16 @@ static int h2_init(struct connection *conn, struct proxy *prx, struct session *s /* 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); @@ -514,7 +514,7 @@ static inline struct h2s *h2c_st_by_id(struct h2c *h2c, int id) */ static void h2_release(struct connection *conn) { - struct h2c *h2c = conn->mux_ctx; + struct h2c *h2c = conn->ctx; LIST_DEL(&conn->list); @@ -543,7 +543,7 @@ static void h2_release(struct connection *conn) } conn->mux = NULL; - conn->mux_ctx = NULL; + conn->ctx = NULL; conn_stop_tracking(conn); conn_full_close(conn); @@ -2694,7 +2694,7 @@ static int h2_process(struct h2c *h2c) static int h2_wake(struct connection *conn) { - struct h2c *h2c = conn->mux_ctx; + struct h2c *h2c = conn->ctx; return (h2_process(h2c)); } @@ -2765,7 +2765,7 @@ static struct conn_stream *h2_attach(struct connection *conn, struct session *se { struct conn_stream *cs; struct h2s *h2s; - struct h2c *h2c = conn->mux_ctx; + struct h2c *h2c = conn->ctx; cs = cs_new(conn); if (!cs) @@ -2785,7 +2785,7 @@ static struct conn_stream *h2_attach(struct connection *conn, struct session *se */ 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; @@ -2804,7 +2804,7 @@ static const struct conn_stream *h2_get_first_cs(const struct connection *conn) */ 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); @@ -4854,7 +4854,7 @@ static size_t h2_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t coun /* 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; diff --git a/src/mux_pt.c b/src/mux_pt.c index 43c3f6fa3..da1c343a7 100644 --- a/src/mux_pt.c +++ b/src/mux_pt.c @@ -33,7 +33,7 @@ static void mux_pt_destroy(struct mux_pt_ctx *ctx) 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 @@ -58,14 +58,14 @@ static struct task *mux_pt_io_cb(struct task *t, void *tctx, unsigned short stat 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) @@ -88,7 +88,7 @@ static int mux_pt_init(struct connection *conn, struct proxy *prx, struct sessio goto fail_free; } - conn->mux_ctx = ctx; + conn->ctx = ctx; ctx->cs = cs; cs->flags |= CS_FL_RCV_MORE; return 0; @@ -108,7 +108,7 @@ fail_free_ctx: */ 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; @@ -141,7 +141,7 @@ static int mux_pt_wake(struct connection *conn) 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); @@ -160,7 +160,7 @@ fail: */ 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; @@ -169,7 +169,7 @@ static const struct conn_stream *mux_pt_get_first_cs(const struct connection *co /* 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); @@ -181,7 +181,7 @@ static void mux_pt_destroy_meth(struct connection *conn) 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 && @@ -195,7 +195,7 @@ static void mux_pt_detach(struct conn_stream *cs) 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); }