mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-03 02:32:03 +00:00
CLEANUP: stconn: rename cs_{new,create,free,destroy}_* to sc_*
This renames the following functions: cs_new_from_endp() -> sc_new_from_endp() cs_new_from_strm() -> sc_new_from_strm() cs_new_from_check() -> sc_new_from_check() cs_applet_create() -> sc_applet_create() cs_destroy() -> sc_destroy() cs_free() -> sc_free()
This commit is contained in:
parent
90e8b455b7
commit
a0b58b537d
@ -38,18 +38,18 @@ struct check;
|
||||
struct sedesc *sedesc_new();
|
||||
void sedesc_free(struct sedesc *sedesc);
|
||||
|
||||
struct stconn *cs_new_from_endp(struct sedesc *sedesc, struct session *sess, struct buffer *input);
|
||||
struct stconn *cs_new_from_strm(struct stream *strm, unsigned int flags);
|
||||
struct stconn *cs_new_from_check(struct check *check, unsigned int flags);
|
||||
void cs_free(struct stconn *cs);
|
||||
struct stconn *sc_new_from_endp(struct sedesc *sedesc, struct session *sess, struct buffer *input);
|
||||
struct stconn *sc_new_from_strm(struct stream *strm, unsigned int flags);
|
||||
struct stconn *sc_new_from_check(struct check *check, unsigned int flags);
|
||||
void sc_free(struct stconn *cs);
|
||||
|
||||
int cs_attach_mux(struct stconn *cs, void *target, void *ctx);
|
||||
int cs_attach_strm(struct stconn *cs, struct stream *strm);
|
||||
|
||||
void cs_destroy(struct stconn *cs);
|
||||
void sc_destroy(struct stconn *cs);
|
||||
int cs_reset_endp(struct stconn *cs);
|
||||
|
||||
struct appctx *cs_applet_create(struct stconn *cs, struct applet *app);
|
||||
struct appctx *sc_applet_create(struct stconn *cs, struct applet *app);
|
||||
|
||||
/* The se_fl_*() set of functions manipulate the stream endpoint flags from
|
||||
* the stream endpoint itself. The sc_ep_*() set of functions manipulate the
|
||||
|
@ -107,7 +107,7 @@ static inline struct stconn *qc_attach_cs(struct qcs *qcs, struct buffer *buf)
|
||||
/* TODO duplicated from mux_h2 */
|
||||
sess->t_idle = tv_ms_elapsed(&sess->tv_accept, &now) - sess->t_handshake;
|
||||
|
||||
if (!cs_new_from_endp(qcs->endp, sess, buf))
|
||||
if (!sc_new_from_endp(qcs->endp, sess, buf))
|
||||
return NULL;
|
||||
|
||||
++qcc->nb_cs;
|
||||
|
@ -98,7 +98,7 @@ int appctx_finalize_startup(struct appctx *appctx, struct proxy *px, struct buff
|
||||
sess = session_new(px, NULL, &appctx->obj_type);
|
||||
if (!sess)
|
||||
return -1;
|
||||
if (!cs_new_from_endp(appctx->sedesc, sess, input)) {
|
||||
if (!sc_new_from_endp(appctx->sedesc, sess, input)) {
|
||||
session_free(sess);
|
||||
return -1;
|
||||
}
|
||||
|
@ -2175,7 +2175,7 @@ void back_handle_st_req(struct stream *s)
|
||||
* in SC_ST_RDY state. So, try to create the appctx now.
|
||||
*/
|
||||
BUG_ON(sc_appctx(cs));
|
||||
appctx = cs_applet_create(cs, objt_applet(s->target));
|
||||
appctx = sc_applet_create(cs, objt_applet(s->target));
|
||||
if (!appctx) {
|
||||
/* No more memory, let's immediately abort. Force the
|
||||
* error code to ignore the ERR_LOCAL which is not a
|
||||
|
@ -1840,7 +1840,7 @@ enum act_return http_action_req_cache_use(struct act_rule *rule, struct proxy *p
|
||||
}
|
||||
|
||||
s->target = &http_cache_applet.obj_type;
|
||||
if ((appctx = cs_applet_create(s->scb, objt_applet(s->target)))) {
|
||||
if ((appctx = sc_applet_create(s->scb, objt_applet(s->target)))) {
|
||||
struct cache_appctx *ctx = applet_reserve_svcctx(appctx, sizeof(*ctx));
|
||||
|
||||
appctx->st0 = HTX_CACHE_INIT;
|
||||
|
@ -1119,7 +1119,7 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state)
|
||||
|
||||
check->current_step = NULL;
|
||||
|
||||
check->cs = cs_new_from_check(check, SC_FL_NONE);
|
||||
check->cs = sc_new_from_check(check, SC_FL_NONE);
|
||||
if (!check->cs) {
|
||||
set_server_check_status(check, HCHK_STATUS_SOCKERR, NULL);
|
||||
goto end;
|
||||
@ -1180,7 +1180,7 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state)
|
||||
}
|
||||
|
||||
if (cs) {
|
||||
cs_destroy(cs);
|
||||
sc_destroy(cs);
|
||||
cs = check->cs = NULL;
|
||||
conn = NULL;
|
||||
}
|
||||
@ -1341,7 +1341,7 @@ void free_check(struct check *check)
|
||||
check_release_buf(check, &check->bi);
|
||||
check_release_buf(check, &check->bo);
|
||||
if (check->cs) {
|
||||
cs_destroy(check->cs);
|
||||
sc_destroy(check->cs);
|
||||
check->cs = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ void sedesc_free(struct sedesc *sedesc)
|
||||
* function. The caller must, at least, set the SE_FL_ORPHAN or SE_FL_DETACHED
|
||||
* flag.
|
||||
*/
|
||||
static struct stconn *cs_new(struct sedesc *sedesc)
|
||||
static struct stconn *sc_new(struct sedesc *sedesc)
|
||||
{
|
||||
struct stconn *cs;
|
||||
|
||||
@ -161,11 +161,11 @@ static struct stconn *cs_new(struct sedesc *sedesc)
|
||||
* defined. It returns NULL on error. On success, the new stream connector is
|
||||
* returned. In this case, SE_FL_ORPHAN flag is removed.
|
||||
*/
|
||||
struct stconn *cs_new_from_endp(struct sedesc *sedesc, struct session *sess, struct buffer *input)
|
||||
struct stconn *sc_new_from_endp(struct sedesc *sedesc, struct session *sess, struct buffer *input)
|
||||
{
|
||||
struct stconn *cs;
|
||||
|
||||
cs = cs_new(sedesc);
|
||||
cs = sc_new(sedesc);
|
||||
if (unlikely(!cs))
|
||||
return NULL;
|
||||
if (unlikely(!stream_new(sess, cs, input))) {
|
||||
@ -177,14 +177,14 @@ struct stconn *cs_new_from_endp(struct sedesc *sedesc, struct session *sess, str
|
||||
}
|
||||
|
||||
/* Creates a new stream connector from an stream. There is no endpoint here, thus it
|
||||
* will be created by cs_new(). So the SE_FL_DETACHED flag is set. It returns
|
||||
* will be created by sc_new(). So the SE_FL_DETACHED flag is set. It returns
|
||||
* NULL on error. On success, the new stream connector is returned.
|
||||
*/
|
||||
struct stconn *cs_new_from_strm(struct stream *strm, unsigned int flags)
|
||||
struct stconn *sc_new_from_strm(struct stream *strm, unsigned int flags)
|
||||
{
|
||||
struct stconn *cs;
|
||||
|
||||
cs = cs_new(NULL);
|
||||
cs = sc_new(NULL);
|
||||
if (unlikely(!cs))
|
||||
return NULL;
|
||||
cs->flags |= flags;
|
||||
@ -195,14 +195,14 @@ struct stconn *cs_new_from_strm(struct stream *strm, unsigned int flags)
|
||||
}
|
||||
|
||||
/* Creates a new stream connector from an health-check. There is no endpoint here,
|
||||
* thus it will be created by cs_new(). So the SE_FL_DETACHED flag is set. It
|
||||
* thus it will be created by sc_new(). So the SE_FL_DETACHED flag is set. It
|
||||
* returns NULL on error. On success, the new stream connector is returned.
|
||||
*/
|
||||
struct stconn *cs_new_from_check(struct check *check, unsigned int flags)
|
||||
struct stconn *sc_new_from_check(struct check *check, unsigned int flags)
|
||||
{
|
||||
struct stconn *cs;
|
||||
|
||||
cs = cs_new(NULL);
|
||||
cs = sc_new(NULL);
|
||||
if (unlikely(!cs))
|
||||
return NULL;
|
||||
cs->flags |= flags;
|
||||
@ -212,10 +212,10 @@ struct stconn *cs_new_from_check(struct check *check, unsigned int flags)
|
||||
return cs;
|
||||
}
|
||||
|
||||
/* Releases a stconn previously allocated by cs_new(), as well as its
|
||||
/* Releases a stconn previously allocated by sc_new(), as well as its
|
||||
* endpoint, if it exists. This function is called internally or on error path.
|
||||
*/
|
||||
void cs_free(struct stconn *cs)
|
||||
void sc_free(struct stconn *cs)
|
||||
{
|
||||
sockaddr_free(&cs->src);
|
||||
sockaddr_free(&cs->dst);
|
||||
@ -232,12 +232,12 @@ void cs_free(struct stconn *cs)
|
||||
* layer defined. Except on error path, this one must be used. if release, the
|
||||
* pointer on the CS is set to NULL.
|
||||
*/
|
||||
static void cs_free_cond(struct stconn **csp)
|
||||
static void sc_free_cond(struct stconn **csp)
|
||||
{
|
||||
struct stconn *cs = *csp;
|
||||
|
||||
if (!cs->app && (!cs->sedesc || sc_ep_test(cs, SE_FL_DETACHED))) {
|
||||
cs_free(cs);
|
||||
sc_free(cs);
|
||||
*csp = NULL;
|
||||
}
|
||||
}
|
||||
@ -394,7 +394,7 @@ static void cs_detach_endp(struct stconn **csp)
|
||||
cs->app_ops = &sc_app_embedded_ops;
|
||||
else
|
||||
cs->app_ops = NULL;
|
||||
cs_free_cond(csp);
|
||||
sc_free_cond(csp);
|
||||
}
|
||||
|
||||
/* Detaches the stconn from the app layer. If there is no endpoint attached
|
||||
@ -416,13 +416,13 @@ static void cs_detach_app(struct stconn **csp)
|
||||
tasklet_free(cs->wait_event.tasklet);
|
||||
cs->wait_event.tasklet = NULL;
|
||||
cs->wait_event.events = 0;
|
||||
cs_free_cond(csp);
|
||||
sc_free_cond(csp);
|
||||
}
|
||||
|
||||
/* Destroy the stconn. It is detached from its endpoint and its
|
||||
* application. After this call, the stconn must be considered as released.
|
||||
*/
|
||||
void cs_destroy(struct stconn *cs)
|
||||
void sc_destroy(struct stconn *cs)
|
||||
{
|
||||
cs_detach_endp(&cs);
|
||||
cs_detach_app(&cs);
|
||||
@ -478,7 +478,7 @@ int cs_reset_endp(struct stconn *cs)
|
||||
* It also pre-initializes the applet's context and returns it (or NULL in case
|
||||
* it could not be allocated).
|
||||
*/
|
||||
struct appctx *cs_applet_create(struct stconn *cs, struct applet *app)
|
||||
struct appctx *sc_applet_create(struct stconn *cs, struct applet *app)
|
||||
{
|
||||
struct appctx *appctx;
|
||||
|
||||
|
@ -430,7 +430,7 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
||||
*/
|
||||
if (!s->target && http_stats_check_uri(s, txn, px)) {
|
||||
s->target = &http_stats_applet.obj_type;
|
||||
if (unlikely(!cs_applet_create(s->scb, objt_applet(s->target)))) {
|
||||
if (unlikely(!sc_applet_create(s->scb, objt_applet(s->target)))) {
|
||||
s->logs.tv_request = now;
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
s->flags |= SF_ERR_RESOURCE;
|
||||
|
@ -732,7 +732,7 @@ static struct stconn *h1s_new_cs(struct h1s *h1s, struct buffer *input)
|
||||
if (h1s->req.flags & H1_MF_UPG_WEBSOCKET)
|
||||
se_fl_set(h1s->endp, SE_FL_WEBSOCKET);
|
||||
|
||||
if (!cs_new_from_endp(h1s->endp, h1c->conn->owner, input)) {
|
||||
if (!sc_new_from_endp(h1s->endp, h1c->conn->owner, input)) {
|
||||
TRACE_ERROR("CS allocation failure", H1_EV_STRM_NEW|H1_EV_STRM_END|H1_EV_STRM_ERR, h1c->conn, h1s);
|
||||
goto err;
|
||||
}
|
||||
|
@ -1635,7 +1635,7 @@ static struct h2s *h2c_frt_stream_new(struct h2c *h2c, int id, struct buffer *in
|
||||
*/
|
||||
sess->t_idle = tv_ms_elapsed(&sess->tv_accept, &now) - sess->t_handshake;
|
||||
|
||||
if (!cs_new_from_endp(h2s->endp, sess, input))
|
||||
if (!sc_new_from_endp(h2s->endp, sess, input))
|
||||
goto out_close;
|
||||
|
||||
h2c->nb_cs++;
|
||||
|
@ -308,7 +308,7 @@ static int mux_pt_init(struct connection *conn, struct proxy *prx, struct sessio
|
||||
ctx->endp->conn = conn;
|
||||
se_fl_set(ctx->endp, SE_FL_T_MUX | SE_FL_ORPHAN);
|
||||
|
||||
cs = cs_new_from_endp(ctx->endp, sess, input);
|
||||
cs = sc_new_from_endp(ctx->endp, sess, input);
|
||||
if (!cs) {
|
||||
TRACE_ERROR("CS allocation failure", PT_EV_STRM_NEW|PT_EV_STRM_END|PT_EV_STRM_ERR, conn);
|
||||
goto fail_free_endp;
|
||||
|
10
src/stream.c
10
src/stream.c
@ -449,7 +449,7 @@ struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer
|
||||
if (cs_attach_strm(s->scf, s) < 0)
|
||||
goto out_fail_attach_scf;
|
||||
|
||||
s->scb = cs_new_from_strm(s, SC_FL_ISBACK);
|
||||
s->scb = sc_new_from_strm(s, SC_FL_ISBACK);
|
||||
if (!s->scb)
|
||||
goto out_fail_alloc_scb;
|
||||
|
||||
@ -568,7 +568,7 @@ struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer
|
||||
flt_stream_release(s, 0);
|
||||
LIST_DELETE(&s->list);
|
||||
out_fail_attach_scf:
|
||||
cs_free(s->scb);
|
||||
sc_free(s->scb);
|
||||
out_fail_alloc_scb:
|
||||
task_destroy(t);
|
||||
out_fail_alloc:
|
||||
@ -708,8 +708,8 @@ void stream_free(struct stream *s)
|
||||
}
|
||||
LIST_DELETE(&s->list);
|
||||
|
||||
cs_destroy(s->scb);
|
||||
cs_destroy(s->scf);
|
||||
sc_destroy(s->scb);
|
||||
sc_destroy(s->scf);
|
||||
|
||||
pool_free(pool_head_stream, s);
|
||||
|
||||
@ -992,7 +992,7 @@ enum act_return process_use_service(struct act_rule *rule, struct proxy *px,
|
||||
if (flags & ACT_OPT_FIRST) {
|
||||
/* Register applet. this function schedules the applet. */
|
||||
s->target = &rule->applet.obj_type;
|
||||
appctx = cs_applet_create(s->scb, objt_applet(s->target));
|
||||
appctx = sc_applet_create(s->scb, objt_applet(s->target));
|
||||
if (unlikely(!appctx))
|
||||
return ACT_RET_ERR;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user