]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: conn_stream: rename the cs_endpoint's context to "conn"
authorWilly Tarreau <w@1wt.eu>
Mon, 16 May 2022 15:17:16 +0000 (17:17 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 17:33:34 +0000 (19:33 +0200)
This one is exclusively used by the connection, regardless its generic
name "ctx" is rather confusing. Let's make it a struct connection* and
call it "conn". This way there's no doubt about what it is and there's
no way it will be used by accident by being taken for something else.

include/haproxy/conn_stream-t.h
include/haproxy/conn_stream.h
include/haproxy/mux_quic.h
src/conn_stream.c
src/mux_h1.c
src/mux_h2.c
src/mux_pt.c

index 6701107e457cc0ccb3b5779584696cba6c7f861d..b56e1bd0394779672fb5f42391088ea8d2a0cb8b 100644 (file)
@@ -157,13 +157,13 @@ struct data_cb {
  * new cs-endpoint (for instance on connection retries).
  *
  * <target> is the mux or the appctx
- * <ctx>    is the context set and used by <target>
+ * <conn>   is the connection for connection-based streams
  * <cs>     is the conn_stream we're attached to, or NULL
  * <flags>  CS_EP_*
 */
 struct cs_endpoint {
        void *target;
-       void *ctx;
+       struct connection *conn;
        struct conn_stream *cs;
        unsigned int flags;
 };
index cfc8a492501b7ad7adfa789df5e178768439d326..16297548238601629f766e17c1569a7bb172fe0c 100644 (file)
@@ -56,19 +56,13 @@ static inline void *__cs_endp_target(const struct conn_stream *cs)
        return cs->endp->target;
 }
 
-/* Returns the endpoint context without any control */
-static inline void *__cs_endp_ctx(const struct conn_stream *cs)
-{
-       return cs->endp->ctx;
-}
-
 /* Returns the connection from a cs if the endpoint is a mux stream. Otherwise
  * NULL is returned. __cs_conn() returns the connection without any control
  * while cs_conn() check the endpoint type.
  */
 static inline struct connection *__cs_conn(const struct conn_stream *cs)
 {
-       return __cs_endp_ctx(cs);
+       return cs->endp->conn;
 }
 static inline struct connection *cs_conn(const struct conn_stream *cs)
 {
index 1d71abde8402ca43d747da6aea80774447e4cf43..b3284b1745387d56104806aa7d951e4d2633c7f1 100644 (file)
@@ -101,7 +101,7 @@ static inline struct conn_stream *qc_attach_cs(struct qcs *qcs, struct buffer *b
                return NULL;
 
        qcs->endp->target = qcs;
-       qcs->endp->ctx = qcc->conn;
+       qcs->endp->conn   = qcc->conn;
        qcs->endp->flags |= (CS_EP_T_MUX|CS_EP_ORPHAN|CS_EP_NOT_FIRST);
 
        /* TODO duplicated from mux_h2 */
index 772feb9bcd9e2e6d5c3ab69cb3ecc26cc7f1657b..9147edac9f3f8593f2c2638534aa545e2643b0db 100644 (file)
@@ -85,7 +85,7 @@ struct data_cb cs_data_applet_cb = {
 void cs_endpoint_init(struct cs_endpoint *endp)
 {
        endp->target = NULL;
-       endp->ctx = NULL;
+       endp->conn = NULL;
        endp->cs = NULL;
        endp->flags = CS_EP_NONE;
 }
@@ -248,7 +248,7 @@ int cs_attach_mux(struct conn_stream *cs, void *target, void *ctx)
        struct connection *conn = ctx;
 
        cs->endp->target = target;
-       cs->endp->ctx = ctx;
+       cs->endp->conn   = ctx;
        cs->endp->flags |= CS_EP_T_MUX;
        cs->endp->flags &= ~CS_EP_DETACHED;
        if (!conn->ctx)
@@ -381,7 +381,7 @@ static void cs_detach_endp(struct conn_stream **csp)
        if (cs->endp) {
                /* the cs is the only one one the endpoint */
                cs->endp->target = NULL;
-               cs->endp->ctx = NULL;
+               cs->endp->conn   = NULL;
                cs->endp->flags &= CS_EP_APP_MASK;
                cs->endp->flags |= CS_EP_DETACHED;
        }
index c5f0b03201705a40874e08dfa4d83e72a82ac186..14e399fe1f21c849d9d377891051b586a6525484 100644 (file)
@@ -822,7 +822,7 @@ static struct h1s *h1c_frt_stream_new(struct h1c *h1c, struct conn_stream *cs, s
                if (!h1s->endp)
                        goto fail;
                h1s->endp->target = h1s;
-               h1s->endp->ctx = h1c->conn;
+               h1s->endp->conn   = h1c->conn;
                h1s->endp->flags |= (CS_EP_T_MUX|CS_EP_ORPHAN);
        }
 
index 9ed272768cf96ffabee0ed13dc2538f8e1a10f68..cd57d98f651821a167a68d15bfdecc3c0b0c366d 100644 (file)
@@ -1613,7 +1613,7 @@ static struct h2s *h2c_frt_stream_new(struct h2c *h2c, int id, struct buffer *in
        if (!h2s->endp)
                goto out_close;
        h2s->endp->target = h2s;
-       h2s->endp->ctx = h2c->conn;
+       h2s->endp->conn   = h2c->conn;
        h2s->endp->flags |= (CS_EP_T_MUX|CS_EP_ORPHAN|CS_EP_NOT_FIRST);
 
        /* FIXME wrong analogy between ext-connect and websocket, this need to
index 821f558ba651400fdd88805cdf4b234d16c1e6c2..338e4fe3432e5b5fff9cc7a53b2c8cf844afe26c 100644 (file)
@@ -299,7 +299,7 @@ static int mux_pt_init(struct connection *conn, struct proxy *prx, struct sessio
                        goto fail_free_ctx;
                }
                ctx->endp->target = ctx;
-               ctx->endp->ctx = conn;
+               ctx->endp->conn   = conn;
                ctx->endp->flags |= (CS_EP_T_MUX|CS_EP_ORPHAN);
 
                cs = cs_new_from_endp(ctx->endp, sess, input);
@@ -419,7 +419,7 @@ static void mux_pt_destroy_meth(void *ctx)
  */
 static void mux_pt_detach(struct cs_endpoint *endp)
 {
-       struct connection *conn = endp->ctx;
+       struct connection *conn = endp->conn;
        struct mux_pt_ctx *ctx;
 
        TRACE_ENTER(PT_EV_STRM_END, conn, endp->cs);