CLEANUP: conn_stream: rename cs_endpoint to sedesc (stream endpoint descriptor)

After some discussion we found that the cs_endpoint was precisely the
descriptor for a stream endpoint, hence the naturally coming name,
stream endpoint constructor.

This patch renames only the type everywhere and the new/init/free functions
to remain consistent with it. Future patches will address field names and
argument names in various code areas.
This commit is contained in:
Willy Tarreau 2022-05-17 17:53:22 +02:00
parent 65d0597b2b
commit ea59b0201c
14 changed files with 95 additions and 91 deletions

View File

@ -38,7 +38,7 @@
struct appctx; struct appctx;
struct proxy; struct proxy;
struct conn_stream; struct conn_stream;
struct cs_endpoint; struct sedesc;
struct session; struct session;
/* Applet descriptor */ /* Applet descriptor */
@ -63,7 +63,7 @@ struct appctx {
struct buffer *chunk; /* used to store unfinished commands */ struct buffer *chunk; /* used to store unfinished commands */
struct applet *applet; /* applet this context refers to */ struct applet *applet; /* applet this context refers to */
struct session *sess; /* session for frontend applets (NULL for backend applets) */ struct session *sess; /* session for frontend applets (NULL for backend applets) */
struct cs_endpoint *endp; struct sedesc *endp;
struct act_rule *rule; /* rule associated with the applet. */ struct act_rule *rule; /* rule associated with the applet. */
int (*io_handler)(struct appctx *appctx); /* used within the cli_io_handler when st0 = CLI_ST_CALLBACK */ int (*io_handler)(struct appctx *appctx); /* used within the cli_io_handler when st0 = CLI_ST_CALLBACK */
void (*io_release)(struct appctx *appctx); /* used within the cli_io_handler when st0 = CLI_ST_CALLBACK, void (*io_release)(struct appctx *appctx); /* used within the cli_io_handler when st0 = CLI_ST_CALLBACK,

View File

@ -40,21 +40,21 @@ int appctx_buf_available(void *arg);
void *applet_reserve_svcctx(struct appctx *appctx, size_t size); void *applet_reserve_svcctx(struct appctx *appctx, size_t size);
void appctx_shut(struct appctx *appctx); void appctx_shut(struct appctx *appctx);
struct appctx *appctx_new(struct applet *applet, struct cs_endpoint *endp, unsigned long thread_mask); struct appctx *appctx_new(struct applet *applet, struct sedesc *endp, unsigned long thread_mask);
int appctx_finalize_startup(struct appctx *appctx, struct proxy *px, struct buffer *input); int appctx_finalize_startup(struct appctx *appctx, struct proxy *px, struct buffer *input);
void appctx_free_on_early_error(struct appctx *appctx); void appctx_free_on_early_error(struct appctx *appctx);
static inline struct appctx *appctx_new_on(struct applet *applet, struct cs_endpoint *endp, uint thr) static inline struct appctx *appctx_new_on(struct applet *applet, struct sedesc *endp, uint thr)
{ {
return appctx_new(applet, endp, 1UL << thr); return appctx_new(applet, endp, 1UL << thr);
} }
static inline struct appctx *appctx_new_here(struct applet *applet, struct cs_endpoint *endp) static inline struct appctx *appctx_new_here(struct applet *applet, struct sedesc *endp)
{ {
return appctx_new(applet, endp, tid_bit); return appctx_new(applet, endp, tid_bit);
} }
static inline struct appctx *appctx_new_anywhere(struct applet *applet, struct cs_endpoint *endp) static inline struct appctx *appctx_new_anywhere(struct applet *applet, struct sedesc *endp)
{ {
return appctx_new(applet, endp, MAX_THREADS_MASK); return appctx_new(applet, endp, MAX_THREADS_MASK);
} }
@ -85,7 +85,7 @@ static inline void __appctx_free(struct appctx *appctx)
if (appctx->sess) if (appctx->sess)
session_free(appctx->sess); session_free(appctx->sess);
BUG_ON(appctx->endp && !se_fl_test(appctx->endp, SE_FL_ORPHAN)); BUG_ON(appctx->endp && !se_fl_test(appctx->endp, SE_FL_ORPHAN));
cs_endpoint_free(appctx->endp); sedesc_free(appctx->endp);
pool_free(pool_head_appctx, appctx); pool_free(pool_head_appctx, appctx);
_HA_ATOMIC_DEC(&nb_applets); _HA_ATOMIC_DEC(&nb_applets);
} }

View File

@ -149,20 +149,24 @@ struct data_cb {
}; };
/* cs_endpoint is the link between the conn-stream and the endpoint (mux or /* A Stream Endpoint Descriptor (sedesc) is the link between the stream
* appctx). It is created by the mux/applet on the client side and share with * connector (ex. conn_stream) and the Stream Endpoint (mux or appctx).
* the conn-stream. On the server side, it is the opposite. A cs-endpoint * It always exists for either of them, and binds them together. It also
* without conn-stream is called an orphan endpoint. A cs-endpoint with no * contains some shared information relative to the endpoint. It is created by
* mux/applet is called a detached endpoint. On detach, the conn-stream * the first one which needs it and is shared by the other one, i.e. on the
* transfers the whole responsibility to the mux/applet and eventually create a * client side, it's created the mux or applet and shared with the connector.
* new cs-endpoint (for instance on connection retries). * An sedesc without stconn is called an ORPHANED descriptor. An sedesc with
* no mux/applet is called a DETACHED descriptor. Upon detach, the connector
* transfers the whole responsibility of the endpoint descriptor to the
* endpoint itself (mux/applet) and eventually creates a new sedesc (for
* instance on connection retries).
* *
* <se> is the stream endpoint, i.e. the mux stream or the appctx * <se> is the stream endpoint, i.e. the mux stream or the appctx
* <conn> is the connection for connection-based streams * <conn> is the connection for connection-based streams
* <cs> is the conn_stream we're attached to, or NULL * <cs> is the conn_stream we're attached to, or NULL
* <flags> SE_FL_* * <flags> SE_FL_*
*/ */
struct cs_endpoint { struct sedesc {
void *se; void *se;
struct connection *conn; struct connection *conn;
struct conn_stream *cs; struct conn_stream *cs;
@ -188,7 +192,7 @@ struct conn_stream {
unsigned int flags; /* CS_FL_* */ unsigned int flags; /* CS_FL_* */
unsigned int hcto; /* half-closed timeout (0 = unset) */ unsigned int hcto; /* half-closed timeout (0 = unset) */
struct wait_event wait_event; /* We're in a wait list */ struct wait_event wait_event; /* We're in a wait list */
struct cs_endpoint *endp; /* points to the end point (MUX stream or appctx) */ struct sedesc *endp; /* points to the end point (MUX stream or appctx) */
enum obj_type *app; /* points to the applicative point (stream or check) */ enum obj_type *app; /* points to the applicative point (stream or check) */
const struct data_cb *data_cb; /* data layer callbacks. Must be set before xprt->init() */ const struct data_cb *data_cb; /* data layer callbacks. Must be set before xprt->init() */
struct cs_app_ops *ops; /* general operations used at the app layer */ struct cs_app_ops *ops; /* general operations used at the app layer */

View File

@ -35,10 +35,10 @@ struct check;
#define IS_HTX_CS(cs) (cs_conn(cs) && IS_HTX_CONN(__cs_conn(cs))) #define IS_HTX_CS(cs) (cs_conn(cs) && IS_HTX_CONN(__cs_conn(cs)))
struct cs_endpoint *cs_endpoint_new(); struct sedesc *sedesc_new();
void cs_endpoint_free(struct cs_endpoint *endp); void sedesc_free(struct sedesc *sedesc);
struct conn_stream *cs_new_from_endp(struct cs_endpoint *endp, struct session *sess, struct buffer *input); struct conn_stream *cs_new_from_endp(struct sedesc *sedesc, struct session *sess, struct buffer *input);
struct conn_stream *cs_new_from_strm(struct stream *strm, unsigned int flags); struct conn_stream *cs_new_from_strm(struct stream *strm, unsigned int flags);
struct conn_stream *cs_new_from_check(struct check *check, unsigned int flags); struct conn_stream *cs_new_from_check(struct check *check, unsigned int flags);
void cs_free(struct conn_stream *cs); void cs_free(struct conn_stream *cs);
@ -62,32 +62,32 @@ struct appctx *cs_applet_create(struct conn_stream *cs, struct applet *app);
*/ */
/* stream endpoint version */ /* stream endpoint version */
static forceinline void se_fl_zero(struct cs_endpoint *se) static forceinline void se_fl_zero(struct sedesc *se)
{ {
se->flags = 0; se->flags = 0;
} }
static forceinline void se_fl_setall(struct cs_endpoint *se, uint all) static forceinline void se_fl_setall(struct sedesc *se, uint all)
{ {
se->flags = all; se->flags = all;
} }
static forceinline void se_fl_set(struct cs_endpoint *se, uint on) static forceinline void se_fl_set(struct sedesc *se, uint on)
{ {
se->flags |= on; se->flags |= on;
} }
static forceinline void se_fl_clr(struct cs_endpoint *se, uint off) static forceinline void se_fl_clr(struct sedesc *se, uint off)
{ {
se->flags &= ~off; se->flags &= ~off;
} }
static forceinline uint se_fl_test(const struct cs_endpoint *se, uint test) static forceinline uint se_fl_test(const struct sedesc *se, uint test)
{ {
return !!(se->flags & test); return !!(se->flags & test);
} }
static forceinline uint se_fl_get(const struct cs_endpoint *se) static forceinline uint se_fl_get(const struct sedesc *se)
{ {
return se->flags; return se->flags;
} }
@ -271,7 +271,7 @@ static inline void cs_conn_drain_and_shut(struct conn_stream *cs)
} }
/* sets SE_FL_ERROR or SE_FL_ERR_PENDING on the endpoint */ /* sets SE_FL_ERROR or SE_FL_ERR_PENDING on the endpoint */
static inline void cs_ep_set_error(struct cs_endpoint *endp) static inline void cs_ep_set_error(struct sedesc *endp)
{ {
if (se_fl_test(endp, SE_FL_EOS)) if (se_fl_test(endp, SE_FL_EOS))
se_fl_set(endp, SE_FL_ERROR); se_fl_set(endp, SE_FL_ERROR);

View File

@ -41,7 +41,7 @@
/* referenced below */ /* referenced below */
struct connection; struct connection;
struct conn_stream; struct conn_stream;
struct cs_endpoint; struct sedesc;
struct cs_info; struct cs_info;
struct buffer; struct buffer;
struct proxy; struct proxy;
@ -396,9 +396,9 @@ struct mux_ops {
void (*shutr)(struct conn_stream *cs, enum co_shr_mode); /* shutr function */ void (*shutr)(struct conn_stream *cs, enum co_shr_mode); /* shutr function */
void (*shutw)(struct conn_stream *cs, enum co_shw_mode); /* shutw function */ void (*shutw)(struct conn_stream *cs, enum co_shw_mode); /* shutw function */
int (*attach)(struct connection *conn, struct cs_endpoint *, struct session *sess); /* attach a conn_stream to an outgoing connection */ int (*attach)(struct connection *conn, struct sedesc *, struct session *sess); /* attach a conn_stream to an outgoing connection */
struct conn_stream *(*get_first_cs)(const struct connection *); /* retrieves any valid conn_stream from this connection */ struct conn_stream *(*get_first_cs)(const struct connection *); /* retrieves any valid conn_stream from this connection */
void (*detach)(struct cs_endpoint *); /* Detach a conn_stream from an outgoing connection, when the request is done */ void (*detach)(struct sedesc *); /* Detach a conn_stream from an outgoing connection, when the request is done */
int (*show_fd)(struct buffer *, struct connection *); /* append some data about connection into chunk for "show fd"; returns non-zero if suspicious */ int (*show_fd)(struct buffer *, struct connection *); /* append some data about connection into chunk for "show fd"; returns non-zero if suspicious */
int (*subscribe)(struct conn_stream *cs, int event_type, struct wait_event *es); /* Subscribe <es> to events, such as "being able to send" */ int (*subscribe)(struct conn_stream *cs, int event_type, struct wait_event *es); /* Subscribe <es> to events, such as "being able to send" */
int (*unsubscribe)(struct conn_stream *cs, int event_type, struct wait_event *es); /* Unsubscribe <es> from events */ int (*unsubscribe)(struct conn_stream *cs, int event_type, struct wait_event *es); /* Unsubscribe <es> from events */

View File

@ -104,7 +104,7 @@ struct qcc {
struct qcs { struct qcs {
struct qcc *qcc; struct qcc *qcc;
struct cs_endpoint *endp; struct sedesc *endp;
uint32_t flags; /* QC_SF_* */ uint32_t flags; /* QC_SF_* */
void *ctx; /* app-ops context */ void *ctx; /* app-ops context */

View File

@ -96,7 +96,7 @@ static inline struct conn_stream *qc_attach_cs(struct qcs *qcs, struct buffer *b
struct qcc *qcc = qcs->qcc; struct qcc *qcc = qcs->qcc;
struct session *sess = qcc->conn->owner; struct session *sess = qcc->conn->owner;
qcs->endp = cs_endpoint_new(); qcs->endp = sedesc_new();
if (!qcs->endp) if (!qcs->endp)
return NULL; return NULL;

View File

@ -31,7 +31,7 @@ DECLARE_POOL(pool_head_appctx, "appctx", sizeof(struct appctx));
* appctx_free(). <applet> is assigned as the applet, but it can be NULL. The * appctx_free(). <applet> is assigned as the applet, but it can be NULL. The
* applet's task is always created on the current thread. * applet's task is always created on the current thread.
*/ */
struct appctx *appctx_new(struct applet *applet, struct cs_endpoint *endp, unsigned long thread_mask) struct appctx *appctx_new(struct applet *applet, struct sedesc *endp, unsigned long thread_mask)
{ {
struct appctx *appctx; struct appctx *appctx;
@ -47,7 +47,7 @@ struct appctx *appctx_new(struct applet *applet, struct cs_endpoint *endp, unsig
appctx->applet = applet; appctx->applet = applet;
appctx->sess = NULL; appctx->sess = NULL;
if (!endp) { if (!endp) {
endp = cs_endpoint_new(); endp = sedesc_new();
if (!endp) if (!endp)
goto fail_endp; goto fail_endp;
endp->se = appctx; endp->se = appctx;
@ -69,7 +69,7 @@ struct appctx *appctx_new(struct applet *applet, struct cs_endpoint *endp, unsig
return appctx; return appctx;
fail_task: fail_task:
cs_endpoint_free(appctx->endp); sedesc_free(appctx->endp);
fail_endp: fail_endp:
pool_free(pool_head_appctx, appctx); pool_free(pool_head_appctx, appctx);
fail_appctx: fail_appctx:

View File

@ -21,7 +21,7 @@
#include <haproxy/pool.h> #include <haproxy/pool.h>
DECLARE_POOL(pool_head_connstream, "conn_stream", sizeof(struct conn_stream)); DECLARE_POOL(pool_head_connstream, "conn_stream", sizeof(struct conn_stream));
DECLARE_POOL(pool_head_cs_endpoint, "cs_endpoint", sizeof(struct cs_endpoint)); DECLARE_POOL(pool_head_sedesc, "sedesc", sizeof(struct sedesc));
/* functions used by default on a detached conn-stream */ /* functions used by default on a detached conn-stream */
static void cs_app_shutr(struct conn_stream *cs); static void cs_app_shutr(struct conn_stream *cs);
@ -82,33 +82,33 @@ struct data_cb cs_data_applet_cb = {
/* Initializes an endpoint */ /* Initializes an endpoint */
void cs_endpoint_init(struct cs_endpoint *endp) void sedesc_init(struct sedesc *sedesc)
{ {
endp->se = NULL; sedesc->se = NULL;
endp->conn = NULL; sedesc->conn = NULL;
endp->cs = NULL; sedesc->cs = NULL;
se_fl_setall(endp, SE_FL_NONE); se_fl_setall(sedesc, SE_FL_NONE);
} }
/* Tries to alloc an endpoint and initialize it. Returns NULL on failure. */ /* Tries to alloc an endpoint and initialize it. Returns NULL on failure. */
struct cs_endpoint *cs_endpoint_new() struct sedesc *sedesc_new()
{ {
struct cs_endpoint *endp; struct sedesc *sedesc;
endp = pool_alloc(pool_head_cs_endpoint); sedesc = pool_alloc(pool_head_sedesc);
if (unlikely(!endp)) if (unlikely(!sedesc))
return NULL; return NULL;
cs_endpoint_init(endp); sedesc_init(sedesc);
return endp; return sedesc;
} }
/* Releases an endpoint. It is the caller responsibility to be sure it is safe /* Releases an endpoint. It is the caller responsibility to be sure it is safe
* and it is not shared with another entity * and it is not shared with another entity
*/ */
void cs_endpoint_free(struct cs_endpoint *endp) void sedesc_free(struct sedesc *sedesc)
{ {
pool_free(pool_head_cs_endpoint, endp); pool_free(pool_head_sedesc, sedesc);
} }
/* Tries to allocate a new conn_stream and initialize its main fields. On /* Tries to allocate a new conn_stream and initialize its main fields. On
@ -116,7 +116,7 @@ void cs_endpoint_free(struct cs_endpoint *endp)
* function. The caller must, at least, set the SE_FL_ORPHAN or SE_FL_DETACHED * function. The caller must, at least, set the SE_FL_ORPHAN or SE_FL_DETACHED
* flag. * flag.
*/ */
static struct conn_stream *cs_new(struct cs_endpoint *endp) static struct conn_stream *cs_new(struct sedesc *sedesc)
{ {
struct conn_stream *cs; struct conn_stream *cs;
@ -137,13 +137,13 @@ static struct conn_stream *cs_new(struct cs_endpoint *endp)
cs->wait_event.events = 0; cs->wait_event.events = 0;
/* If there is no endpoint, allocate a new one now */ /* If there is no endpoint, allocate a new one now */
if (!endp) { if (!sedesc) {
endp = cs_endpoint_new(); sedesc = sedesc_new();
if (unlikely(!endp)) if (unlikely(!sedesc))
goto alloc_error; goto alloc_error;
} }
cs->endp = endp; cs->endp = sedesc;
endp->cs = cs; sedesc->cs = cs;
return cs; return cs;
@ -156,18 +156,18 @@ static struct conn_stream *cs_new(struct cs_endpoint *endp)
* defined. It returns NULL on error. On success, the new conn-stream is * defined. It returns NULL on error. On success, the new conn-stream is
* returned. In this case, SE_FL_ORPHAN flag is removed. * returned. In this case, SE_FL_ORPHAN flag is removed.
*/ */
struct conn_stream *cs_new_from_endp(struct cs_endpoint *endp, struct session *sess, struct buffer *input) struct conn_stream *cs_new_from_endp(struct sedesc *sedesc, struct session *sess, struct buffer *input)
{ {
struct conn_stream *cs; struct conn_stream *cs;
cs = cs_new(endp); cs = cs_new(sedesc);
if (unlikely(!cs)) if (unlikely(!cs))
return NULL; return NULL;
if (unlikely(!stream_new(sess, cs, input))) { if (unlikely(!stream_new(sess, cs, input))) {
pool_free(pool_head_connstream, cs); pool_free(pool_head_connstream, cs);
cs = NULL; cs = NULL;
} }
se_fl_clr(endp, SE_FL_ORPHAN); se_fl_clr(sedesc, SE_FL_ORPHAN);
return cs; return cs;
} }
@ -217,7 +217,7 @@ void cs_free(struct conn_stream *cs)
sockaddr_free(&cs->dst); sockaddr_free(&cs->dst);
if (cs->endp) { if (cs->endp) {
BUG_ON(!sc_ep_test(cs, SE_FL_DETACHED)); BUG_ON(!sc_ep_test(cs, SE_FL_DETACHED));
cs_endpoint_free(cs->endp); sedesc_free(cs->endp);
} }
if (cs->wait_event.tasklet) if (cs->wait_event.tasklet)
tasklet_free(cs->wait_event.tasklet); tasklet_free(cs->wait_event.tasklet);
@ -347,7 +347,7 @@ static void cs_detach_endp(struct conn_stream **csp)
if (sc_ep_test(cs, SE_FL_T_MUX)) { if (sc_ep_test(cs, SE_FL_T_MUX)) {
struct connection *conn = __cs_conn(cs); struct connection *conn = __cs_conn(cs);
struct cs_endpoint *endp = cs->endp; struct sedesc *endp = cs->endp;
if (conn->mux) { if (conn->mux) {
if (cs->wait_event.events != 0) if (cs->wait_event.events != 0)
@ -438,7 +438,7 @@ void cs_destroy(struct conn_stream *cs)
*/ */
int cs_reset_endp(struct conn_stream *cs) int cs_reset_endp(struct conn_stream *cs)
{ {
struct cs_endpoint *new_endp; struct sedesc *new_endp;
BUG_ON(!cs->app); BUG_ON(!cs->app);
@ -455,7 +455,7 @@ int cs_reset_endp(struct conn_stream *cs)
/* allocate the new endpoint first to be able to set error if it /* allocate the new endpoint first to be able to set error if it
* fails */ * fails */
new_endp = cs_endpoint_new(); new_endp = sedesc_new();
if (!unlikely(new_endp)) { if (!unlikely(new_endp)) {
sc_ep_set(cs, SE_FL_ERROR); sc_ep_set(cs, SE_FL_ERROR);
return -1; return -1;

View File

@ -154,7 +154,7 @@ enum fcgi_strm_st {
/* FCGI stream descriptor */ /* FCGI stream descriptor */
struct fcgi_strm { struct fcgi_strm {
struct cs_endpoint *endp; struct sedesc *endp;
struct session *sess; struct session *sess;
struct fcgi_conn *fconn; struct fcgi_conn *fconn;
@ -371,14 +371,14 @@ static void fcgi_strm_alert(struct fcgi_strm *fstrm);
static int fcgi_strm_send_abort(struct fcgi_conn *fconn, struct fcgi_strm *fstrm); static int fcgi_strm_send_abort(struct fcgi_conn *fconn, struct fcgi_strm *fstrm);
/* a dummy closed endpoint */ /* a dummy closed endpoint */
static const struct cs_endpoint closed_ep = { static const struct sedesc closed_ep = {
. cs = NULL, . cs = NULL,
.flags = SE_FL_DETACHED, .flags = SE_FL_DETACHED,
}; };
/* a dmumy management stream */ /* a dmumy management stream */
static const struct fcgi_strm *fcgi_mgmt_stream = &(const struct fcgi_strm){ static const struct fcgi_strm *fcgi_mgmt_stream = &(const struct fcgi_strm){
.endp = (struct cs_endpoint*)&closed_ep, .endp = (struct sedesc*)&closed_ep,
.fconn = NULL, .fconn = NULL,
.state = FCGI_SS_CLOSED, .state = FCGI_SS_CLOSED,
.flags = FCGI_SF_NONE, .flags = FCGI_SF_NONE,
@ -387,7 +387,7 @@ static const struct fcgi_strm *fcgi_mgmt_stream = &(const struct fcgi_strm){
/* and a dummy idle stream for use with any unknown stream */ /* and a dummy idle stream for use with any unknown stream */
static const struct fcgi_strm *fcgi_unknown_stream = &(const struct fcgi_strm){ static const struct fcgi_strm *fcgi_unknown_stream = &(const struct fcgi_strm){
.endp = (struct cs_endpoint*)&closed_ep, .endp = (struct sedesc*)&closed_ep,
.fconn = NULL, .fconn = NULL,
.state = FCGI_SS_IDLE, .state = FCGI_SS_IDLE,
.flags = FCGI_SF_NONE, .flags = FCGI_SF_NONE,
@ -1040,7 +1040,7 @@ static void fcgi_strm_destroy(struct fcgi_strm *fstrm)
LIST_DEL_INIT(&fstrm->send_list); LIST_DEL_INIT(&fstrm->send_list);
tasklet_free(fstrm->shut_tl); tasklet_free(fstrm->shut_tl);
BUG_ON(fstrm->endp && !se_fl_test(fstrm->endp, SE_FL_ORPHAN)); BUG_ON(fstrm->endp && !se_fl_test(fstrm->endp, SE_FL_ORPHAN));
cs_endpoint_free(fstrm->endp); sedesc_free(fstrm->endp);
pool_free(pool_head_fcgi_strm, fstrm); pool_free(pool_head_fcgi_strm, fstrm);
TRACE_LEAVE(FCGI_EV_FSTRM_END, conn); TRACE_LEAVE(FCGI_EV_FSTRM_END, conn);
@ -3521,7 +3521,7 @@ static size_t fcgi_strm_parse_response(struct fcgi_strm *fstrm, struct buffer *b
* Attach a new stream to a connection * Attach a new stream to a connection
* (Used for outgoing connections) * (Used for outgoing connections)
*/ */
static int fcgi_attach(struct connection *conn, struct cs_endpoint *endp, struct session *sess) static int fcgi_attach(struct connection *conn, struct sedesc *endp, struct session *sess)
{ {
struct fcgi_strm *fstrm; struct fcgi_strm *fstrm;
struct fcgi_conn *fconn = conn->ctx; struct fcgi_conn *fconn = conn->ctx;
@ -3581,7 +3581,7 @@ static void fcgi_destroy(void *ctx)
/* /*
* Detach the stream from the connection and possibly release the connection. * Detach the stream from the connection and possibly release the connection.
*/ */
static void fcgi_detach(struct cs_endpoint *endp) static void fcgi_detach(struct sedesc *endp)
{ {
struct fcgi_strm *fstrm = endp->se; struct fcgi_strm *fstrm = endp->se;
struct fcgi_conn *fconn; struct fcgi_conn *fconn;

View File

@ -118,7 +118,7 @@ struct h1c {
/* H1 stream descriptor */ /* H1 stream descriptor */
struct h1s { struct h1s {
struct h1c *h1c; struct h1c *h1c;
struct cs_endpoint *endp; struct sedesc *endp;
uint32_t flags; /* Connection flags: H1S_F_* */ uint32_t flags; /* Connection flags: H1S_F_* */
struct wait_event *subs; /* Address of the wait_event the conn_stream associated is waiting on */ struct wait_event *subs; /* Address of the wait_event the conn_stream associated is waiting on */
@ -818,7 +818,7 @@ static struct h1s *h1c_frt_stream_new(struct h1c *h1c, struct conn_stream *cs, s
h1s->endp = cs->endp; h1s->endp = cs->endp;
} }
else { else {
h1s->endp = cs_endpoint_new(); h1s->endp = sedesc_new();
if (!h1s->endp) if (!h1s->endp)
goto fail; goto fail;
h1s->endp->se = h1s; h1s->endp->se = h1s;
@ -912,7 +912,7 @@ static void h1s_destroy(struct h1s *h1s)
HA_ATOMIC_DEC(&h1c->px_counters->open_streams); HA_ATOMIC_DEC(&h1c->px_counters->open_streams);
BUG_ON(h1s->endp && !se_fl_test(h1s->endp, SE_FL_ORPHAN)); BUG_ON(h1s->endp && !se_fl_test(h1s->endp, SE_FL_ORPHAN));
cs_endpoint_free(h1s->endp); sedesc_free(h1s->endp);
pool_free(pool_head_h1s, h1s); pool_free(pool_head_h1s, h1s);
} }
} }
@ -3303,7 +3303,7 @@ struct task *h1_timeout_task(struct task *t, void *context, unsigned int state)
* Attach a new stream to a connection * Attach a new stream to a connection
* (Used for outgoing connections) * (Used for outgoing connections)
*/ */
static int h1_attach(struct connection *conn, struct cs_endpoint *endp, struct session *sess) static int h1_attach(struct connection *conn, struct sedesc *endp, struct session *sess)
{ {
struct h1c *h1c = conn->ctx; struct h1c *h1c = conn->ctx;
struct h1s *h1s; struct h1s *h1s;
@ -3357,7 +3357,7 @@ static void h1_destroy(void *ctx)
/* /*
* Detach the stream from the connection and possibly release the connection. * Detach the stream from the connection and possibly release the connection.
*/ */
static void h1_detach(struct cs_endpoint *endp) static void h1_detach(struct sedesc *endp)
{ {
struct h1s *h1s = endp->se; struct h1s *h1s = endp->se;
struct h1c *h1c; struct h1c *h1c;

View File

@ -212,7 +212,7 @@ enum h2_ss {
* it is being processed in the internal HTTP representation (HTX). * it is being processed in the internal HTTP representation (HTX).
*/ */
struct h2s { struct h2s {
struct cs_endpoint *endp; struct sedesc *endp;
struct session *sess; struct session *sess;
struct h2c *h2c; struct h2c *h2c;
struct eb32_node by_id; /* place in h2c's streams_by_id */ struct eb32_node by_id; /* place in h2c's streams_by_id */
@ -523,14 +523,14 @@ static unsigned int h2_settings_max_concurrent_streams = 100;
static int h2_settings_max_frame_size = 0; /* unset */ static int h2_settings_max_frame_size = 0; /* unset */
/* a dummy closed endpoint */ /* a dummy closed endpoint */
static const struct cs_endpoint closed_ep = { static const struct sedesc closed_ep = {
. cs = NULL, . cs = NULL,
.flags = SE_FL_DETACHED, .flags = SE_FL_DETACHED,
}; };
/* a dmumy closed stream */ /* a dmumy closed stream */
static const struct h2s *h2_closed_stream = &(const struct h2s){ static const struct h2s *h2_closed_stream = &(const struct h2s){
.endp = (struct cs_endpoint *)&closed_ep, .endp = (struct sedesc *)&closed_ep,
.h2c = NULL, .h2c = NULL,
.st = H2_SS_CLOSED, .st = H2_SS_CLOSED,
.errcode = H2_ERR_STREAM_CLOSED, .errcode = H2_ERR_STREAM_CLOSED,
@ -540,7 +540,7 @@ static const struct h2s *h2_closed_stream = &(const struct h2s){
/* a dmumy closed stream returning a PROTOCOL_ERROR error */ /* a dmumy closed stream returning a PROTOCOL_ERROR error */
static const struct h2s *h2_error_stream = &(const struct h2s){ static const struct h2s *h2_error_stream = &(const struct h2s){
.endp = (struct cs_endpoint *)&closed_ep, .endp = (struct sedesc *)&closed_ep,
.h2c = NULL, .h2c = NULL,
.st = H2_SS_CLOSED, .st = H2_SS_CLOSED,
.errcode = H2_ERR_PROTOCOL_ERROR, .errcode = H2_ERR_PROTOCOL_ERROR,
@ -550,7 +550,7 @@ static const struct h2s *h2_error_stream = &(const struct h2s){
/* a dmumy closed stream returning a REFUSED_STREAM error */ /* a dmumy closed stream returning a REFUSED_STREAM error */
static const struct h2s *h2_refused_stream = &(const struct h2s){ static const struct h2s *h2_refused_stream = &(const struct h2s){
.endp = (struct cs_endpoint *)&closed_ep, .endp = (struct sedesc *)&closed_ep,
.h2c = NULL, .h2c = NULL,
.st = H2_SS_CLOSED, .st = H2_SS_CLOSED,
.errcode = H2_ERR_REFUSED_STREAM, .errcode = H2_ERR_REFUSED_STREAM,
@ -560,7 +560,7 @@ static const struct h2s *h2_refused_stream = &(const struct h2s){
/* and a dummy idle stream for use with any unannounced stream */ /* and a dummy idle stream for use with any unannounced stream */
static const struct h2s *h2_idle_stream = &(const struct h2s){ static const struct h2s *h2_idle_stream = &(const struct h2s){
.endp = (struct cs_endpoint *)&closed_ep, .endp = (struct sedesc *)&closed_ep,
.h2c = NULL, .h2c = NULL,
.st = H2_SS_IDLE, .st = H2_SS_IDLE,
.errcode = H2_ERR_STREAM_CLOSED, .errcode = H2_ERR_STREAM_CLOSED,
@ -1525,7 +1525,7 @@ static void h2s_destroy(struct h2s *h2s)
/* ditto, calling tasklet_free() here should be ok */ /* ditto, calling tasklet_free() here should be ok */
tasklet_free(h2s->shut_tl); tasklet_free(h2s->shut_tl);
BUG_ON(h2s->endp && !se_fl_test(h2s->endp, SE_FL_ORPHAN)); BUG_ON(h2s->endp && !se_fl_test(h2s->endp, SE_FL_ORPHAN));
cs_endpoint_free(h2s->endp); sedesc_free(h2s->endp);
pool_free(pool_head_h2s, h2s); pool_free(pool_head_h2s, h2s);
TRACE_LEAVE(H2_EV_H2S_END, conn); TRACE_LEAVE(H2_EV_H2S_END, conn);
@ -1609,7 +1609,7 @@ static struct h2s *h2c_frt_stream_new(struct h2c *h2c, int id, struct buffer *in
if (!h2s) if (!h2s)
goto out_alloc; goto out_alloc;
h2s->endp = cs_endpoint_new(); h2s->endp = sedesc_new();
if (!h2s->endp) if (!h2s->endp)
goto out_close; goto out_close;
h2s->endp->se = h2s; h2s->endp->se = h2s;
@ -4289,7 +4289,7 @@ do_leave:
* Attach a new stream to a connection * Attach a new stream to a connection
* (Used for outgoing connections) * (Used for outgoing connections)
*/ */
static int h2_attach(struct connection *conn, struct cs_endpoint *endp, struct session *sess) static int h2_attach(struct connection *conn, struct sedesc *endp, struct session *sess)
{ {
struct h2s *h2s; struct h2s *h2s;
struct h2c *h2c = conn->ctx; struct h2c *h2c = conn->ctx;
@ -4368,7 +4368,7 @@ static void h2_destroy(void *ctx)
/* /*
* Detach the stream from the connection and possibly release the connection. * Detach the stream from the connection and possibly release the connection.
*/ */
static void h2_detach(struct cs_endpoint *endp) static void h2_detach(struct sedesc *endp)
{ {
struct h2s *h2s = endp->se; struct h2s *h2s = endp->se;
struct h2c *h2c; struct h2c *h2c;

View File

@ -20,7 +20,7 @@
#include <haproxy/trace.h> #include <haproxy/trace.h>
struct mux_pt_ctx { struct mux_pt_ctx {
struct cs_endpoint *endp; struct sedesc *endp;
struct connection *conn; struct connection *conn;
struct wait_event wait_event; struct wait_event wait_event;
}; };
@ -209,7 +209,7 @@ static void mux_pt_destroy(struct mux_pt_ctx *ctx)
conn->xprt->unsubscribe(conn, conn->xprt_ctx, ctx->wait_event.events, conn->xprt->unsubscribe(conn, conn->xprt_ctx, ctx->wait_event.events,
&ctx->wait_event); &ctx->wait_event);
BUG_ON(ctx->endp && !se_fl_test(ctx->endp, SE_FL_ORPHAN)); BUG_ON(ctx->endp && !se_fl_test(ctx->endp, SE_FL_ORPHAN));
cs_endpoint_free(ctx->endp); sedesc_free(ctx->endp);
pool_free(pool_head_pt_ctx, ctx); pool_free(pool_head_pt_ctx, ctx);
if (conn) { if (conn) {
@ -293,7 +293,7 @@ static int mux_pt_init(struct connection *conn, struct proxy *prx, struct sessio
ctx->conn = conn; ctx->conn = conn;
if (!cs) { if (!cs) {
ctx->endp = cs_endpoint_new(); ctx->endp = sedesc_new();
if (!ctx->endp) { if (!ctx->endp) {
TRACE_ERROR("CS allocation failure", PT_EV_STRM_NEW|PT_EV_STRM_END|PT_EV_STRM_ERR, conn); TRACE_ERROR("CS allocation failure", PT_EV_STRM_NEW|PT_EV_STRM_END|PT_EV_STRM_ERR, conn);
goto fail_free_ctx; goto fail_free_ctx;
@ -323,7 +323,7 @@ static int mux_pt_init(struct connection *conn, struct proxy *prx, struct sessio
return 0; return 0;
fail_free_endp: fail_free_endp:
cs_endpoint_free(ctx->endp); sedesc_free(ctx->endp);
fail_free_ctx: fail_free_ctx:
if (ctx->wait_event.tasklet) if (ctx->wait_event.tasklet)
tasklet_free(ctx->wait_event.tasklet); tasklet_free(ctx->wait_event.tasklet);
@ -373,7 +373,7 @@ static int mux_pt_wake(struct connection *conn)
* Attach a new stream to a connection * Attach a new stream to a connection
* (Used for outgoing connections) * (Used for outgoing connections)
*/ */
static int mux_pt_attach(struct connection *conn, struct cs_endpoint *endp, struct session *sess) static int mux_pt_attach(struct connection *conn, struct sedesc *endp, struct session *sess)
{ {
struct mux_pt_ctx *ctx = conn->ctx; struct mux_pt_ctx *ctx = conn->ctx;
@ -417,7 +417,7 @@ static void mux_pt_destroy_meth(void *ctx)
/* /*
* Detach the stream from the connection and possibly release the connection. * Detach the stream from the connection and possibly release the connection.
*/ */
static void mux_pt_detach(struct cs_endpoint *endp) static void mux_pt_detach(struct sedesc *endp)
{ {
struct connection *conn = endp->conn; struct connection *conn = endp->conn;
struct mux_pt_ctx *ctx; struct mux_pt_ctx *ctx;

View File

@ -214,7 +214,7 @@ void qcs_free(struct qcs *qcs)
qc_stream_desc_release(qcs->stream); qc_stream_desc_release(qcs->stream);
BUG_ON(qcs->endp && !se_fl_test(qcs->endp, SE_FL_ORPHAN)); BUG_ON(qcs->endp && !se_fl_test(qcs->endp, SE_FL_ORPHAN));
cs_endpoint_free(qcs->endp); sedesc_free(qcs->endp);
eb64_delete(&qcs->by_id); eb64_delete(&qcs->by_id);
pool_free(pool_head_qcs, qcs); pool_free(pool_head_qcs, qcs);
@ -1422,7 +1422,7 @@ static void qc_destroy(void *ctx)
TRACE_LEAVE(QMUX_EV_QCC_END); TRACE_LEAVE(QMUX_EV_QCC_END);
} }
static void qc_detach(struct cs_endpoint *endp) static void qc_detach(struct sedesc *endp)
{ {
struct qcs *qcs = endp->se; struct qcs *qcs = endp->se;
struct qcc *qcc = qcs->qcc; struct qcc *qcc = qcs->qcc;