mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-04 20:46:11 +02:00
CLEANUP: stconn: rename cs_appctx() to sc_appctx()
Nothing special, just s/cs/sc/, roughly 50-60 entries.
This commit is contained in:
parent
417a31bb55
commit
8e7c6e6907
@ -171,17 +171,17 @@ static inline struct appctx *sc_mux_strm(const struct stconn *cs)
|
||||
}
|
||||
|
||||
/* Returns the appctx from a cs if the endpoint is an appctx. Otherwise
|
||||
* NULL is returned. __cs_appctx() returns the appctx without any control
|
||||
* while cs_appctx() check the endpoint type.
|
||||
* NULL is returned. __sc_appctx() returns the appctx without any control
|
||||
* while sc_appctx() checks the endpoint type.
|
||||
*/
|
||||
static inline struct appctx *__cs_appctx(const struct stconn *cs)
|
||||
static inline struct appctx *__sc_appctx(const struct stconn *cs)
|
||||
{
|
||||
return __cs_endp_target(cs);
|
||||
}
|
||||
static inline struct appctx *cs_appctx(const struct stconn *cs)
|
||||
static inline struct appctx *sc_appctx(const struct stconn *cs)
|
||||
{
|
||||
if (sc_ep_test(cs, SE_FL_T_APPLET))
|
||||
return __cs_appctx(cs);
|
||||
return __sc_appctx(cs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -2174,7 +2174,7 @@ void back_handle_st_req(struct stream *s)
|
||||
* means no appctx are attached to the CS. Otherwise, it will be
|
||||
* in SC_ST_RDY state. So, try to create the appctx now.
|
||||
*/
|
||||
BUG_ON(cs_appctx(cs));
|
||||
BUG_ON(sc_appctx(cs));
|
||||
appctx = cs_applet_create(cs, objt_applet(s->target));
|
||||
if (!appctx) {
|
||||
/* No more memory, let's immediately abort. Force the
|
||||
@ -2447,7 +2447,7 @@ void back_handle_st_rdy(struct stream *s)
|
||||
/* Here the appctx must exists because the CS was set to
|
||||
* SC_ST_RDY state when the appctx was created.
|
||||
*/
|
||||
BUG_ON(!cs_appctx(s->scb));
|
||||
BUG_ON(!sc_appctx(s->scb));
|
||||
|
||||
if (tv_iszero(&s->logs.tv_request))
|
||||
s->logs.tv_request = now;
|
||||
|
||||
@ -2686,7 +2686,7 @@ smp_fetch_res_cache_name(const struct arg *args, struct sample *smp,
|
||||
return 0;
|
||||
|
||||
/* Get appctx from the stream connector. */
|
||||
appctx = cs_appctx(smp->strm->scb);
|
||||
appctx = sc_appctx(smp->strm->scb);
|
||||
if (appctx && appctx->rule) {
|
||||
cconf = appctx->rule->arg.act.p[0];
|
||||
if (cconf) {
|
||||
|
||||
@ -368,7 +368,7 @@ static void cs_detach_endp(struct stconn **csp)
|
||||
}
|
||||
}
|
||||
else if (sc_ep_test(cs, SE_FL_T_APPLET)) {
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
|
||||
sc_ep_set(cs, SE_FL_ORPHAN);
|
||||
cs->sedesc->sc = NULL;
|
||||
@ -876,7 +876,7 @@ static void sc_app_shutr_applet(struct stconn *cs)
|
||||
{
|
||||
struct channel *ic = sc_ic(cs);
|
||||
|
||||
BUG_ON(!cs_appctx(cs));
|
||||
BUG_ON(!sc_appctx(cs));
|
||||
|
||||
cs_rx_shut_blk(cs);
|
||||
if (ic->flags & CF_SHUTR)
|
||||
@ -890,7 +890,7 @@ static void sc_app_shutr_applet(struct stconn *cs)
|
||||
return;
|
||||
|
||||
if (sc_oc(cs)->flags & CF_SHUTW) {
|
||||
appctx_shut(__cs_appctx(cs));
|
||||
appctx_shut(__sc_appctx(cs));
|
||||
cs->state = SC_ST_DIS;
|
||||
__sc_strm(cs)->conn_exp = TICK_ETERNITY;
|
||||
}
|
||||
@ -912,7 +912,7 @@ static void sc_app_shutw_applet(struct stconn *cs)
|
||||
struct channel *ic = sc_ic(cs);
|
||||
struct channel *oc = sc_oc(cs);
|
||||
|
||||
BUG_ON(!cs_appctx(cs));
|
||||
BUG_ON(!sc_appctx(cs));
|
||||
|
||||
oc->flags &= ~CF_SHUTW_NOW;
|
||||
if (oc->flags & CF_SHUTW)
|
||||
@ -927,7 +927,7 @@ static void sc_app_shutw_applet(struct stconn *cs)
|
||||
}
|
||||
|
||||
/* on shutw we always wake the applet up */
|
||||
appctx_wakeup(__cs_appctx(cs));
|
||||
appctx_wakeup(__sc_appctx(cs));
|
||||
|
||||
switch (cs->state) {
|
||||
case SC_ST_RDY:
|
||||
@ -948,7 +948,7 @@ static void sc_app_shutw_applet(struct stconn *cs)
|
||||
case SC_ST_QUE:
|
||||
case SC_ST_TAR:
|
||||
/* Note that none of these states may happen with applets */
|
||||
appctx_shut(__cs_appctx(cs));
|
||||
appctx_shut(__sc_appctx(cs));
|
||||
cs->state = SC_ST_DIS;
|
||||
/* fall through */
|
||||
default:
|
||||
@ -965,7 +965,7 @@ static void sc_app_chk_rcv_applet(struct stconn *cs)
|
||||
{
|
||||
struct channel *ic = sc_ic(cs);
|
||||
|
||||
BUG_ON(!cs_appctx(cs));
|
||||
BUG_ON(!sc_appctx(cs));
|
||||
|
||||
DPRINTF(stderr, "%s: cs=%p, cs->state=%d ic->flags=%08x oc->flags=%08x\n",
|
||||
__FUNCTION__,
|
||||
@ -973,7 +973,7 @@ static void sc_app_chk_rcv_applet(struct stconn *cs)
|
||||
|
||||
if (!ic->pipe) {
|
||||
/* (re)start reading */
|
||||
appctx_wakeup(__cs_appctx(cs));
|
||||
appctx_wakeup(__sc_appctx(cs));
|
||||
}
|
||||
}
|
||||
|
||||
@ -982,7 +982,7 @@ static void sc_app_chk_snd_applet(struct stconn *cs)
|
||||
{
|
||||
struct channel *oc = sc_oc(cs);
|
||||
|
||||
BUG_ON(!cs_appctx(cs));
|
||||
BUG_ON(!sc_appctx(cs));
|
||||
|
||||
DPRINTF(stderr, "%s: cs=%p, cs->state=%d ic->flags=%08x oc->flags=%08x\n",
|
||||
__FUNCTION__,
|
||||
@ -1001,7 +1001,7 @@ static void sc_app_chk_snd_applet(struct stconn *cs)
|
||||
|
||||
if (!channel_is_empty(oc)) {
|
||||
/* (re)start sending */
|
||||
appctx_wakeup(__cs_appctx(cs));
|
||||
appctx_wakeup(__sc_appctx(cs));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1928,7 +1928,7 @@ static int cs_applet_process(struct stconn *cs)
|
||||
{
|
||||
struct channel *ic = sc_ic(cs);
|
||||
|
||||
BUG_ON(!cs_appctx(cs));
|
||||
BUG_ON(!sc_appctx(cs));
|
||||
|
||||
/* If the applet wants to write and the channel is closed, it's a
|
||||
* broken pipe and it must be reported.
|
||||
@ -1953,6 +1953,6 @@ static int cs_applet_process(struct stconn *cs)
|
||||
*/
|
||||
if ((cs_rx_endp_ready(cs) && !cs_rx_blocked(cs)) ||
|
||||
(cs_tx_endp_ready(cs) && !cs_tx_blocked(cs)))
|
||||
appctx_wakeup(__cs_appctx(cs));
|
||||
appctx_wakeup(__sc_appctx(cs));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2747,7 +2747,7 @@ __LJMP static int hlua_socket_connect_yield(struct lua_State *L, int status, lua
|
||||
return 2;
|
||||
}
|
||||
|
||||
appctx = __cs_appctx(s->scf);
|
||||
appctx = __sc_appctx(s->scf);
|
||||
|
||||
/* Check for connection established. */
|
||||
if (csk_ctx->connected) {
|
||||
|
||||
@ -3973,7 +3973,7 @@ static int http_handle_stats(struct stream *s, struct channel *req)
|
||||
struct http_msg *msg = &txn->req;
|
||||
struct uri_auth *uri_auth = s->be->uri_auth;
|
||||
const char *h, *lookup, *end;
|
||||
struct appctx *appctx = __cs_appctx(s->scb);
|
||||
struct appctx *appctx = __sc_appctx(s->scb);
|
||||
struct show_stat_ctx *ctx = applet_reserve_svcctx(appctx, sizeof(*ctx));
|
||||
struct htx *htx;
|
||||
struct htx_sl *sl;
|
||||
|
||||
@ -2708,7 +2708,7 @@ static void dump_server_addr(const struct sockaddr_storage *addr, char *addr_str
|
||||
*/
|
||||
static int dump_servers_state(struct stconn *cs)
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_srv_ctx *ctx = appctx->svcctx;
|
||||
struct proxy *px = ctx->px;
|
||||
struct server *srv;
|
||||
|
||||
@ -2592,7 +2592,7 @@ static int stats_dump_resolv_to_buffer(struct stconn *cs,
|
||||
struct field *stats, size_t stats_count,
|
||||
struct list *stat_modules)
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct channel *rep = sc_ic(cs);
|
||||
struct stats_module *mod;
|
||||
size_t idx = 0;
|
||||
@ -2626,7 +2626,7 @@ int stats_dump_resolvers(struct stconn *cs,
|
||||
struct field *stats, size_t stats_count,
|
||||
struct list *stat_modules)
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
struct channel *rep = sc_ic(cs);
|
||||
struct resolvers *resolver = ctx->obj1;
|
||||
|
||||
28
src/stats.c
28
src/stats.c
@ -1814,7 +1814,7 @@ int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len,
|
||||
*/
|
||||
static int stats_dump_fe_stats(struct stconn *cs, struct proxy *px)
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
struct field *stats = stat_l[STATS_DOMAIN_PROXY];
|
||||
struct stats_module *mod;
|
||||
@ -1982,7 +1982,7 @@ int stats_fill_li_stats(struct proxy *px, struct listener *l, int flags,
|
||||
*/
|
||||
static int stats_dump_li_stats(struct stconn *cs, struct proxy *px, struct listener *l)
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
struct field *stats = stat_l[STATS_DOMAIN_PROXY];
|
||||
struct stats_module *mod;
|
||||
@ -2494,7 +2494,7 @@ int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags,
|
||||
*/
|
||||
static int stats_dump_sv_stats(struct stconn *cs, struct proxy *px, struct server *sv)
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
struct stats_module *mod;
|
||||
struct field *stats = stat_l[STATS_DOMAIN_PROXY];
|
||||
@ -2820,7 +2820,7 @@ int stats_fill_be_stats(struct proxy *px, int flags, struct field *stats, int le
|
||||
*/
|
||||
static int stats_dump_be_stats(struct stconn *cs, struct proxy *px)
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
struct field *stats = stat_l[STATS_DOMAIN_PROXY];
|
||||
struct stats_module *mod;
|
||||
@ -2862,7 +2862,7 @@ static int stats_dump_be_stats(struct stconn *cs, struct proxy *px)
|
||||
*/
|
||||
static void stats_dump_html_px_hdr(struct stconn *cs, struct proxy *px)
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
char scope_txt[STAT_SCOPE_TXT_MAXLEN + sizeof STAT_SCOPE_PATTERN];
|
||||
struct stats_module *mod;
|
||||
@ -2972,7 +2972,7 @@ static void stats_dump_html_px_hdr(struct stconn *cs, struct proxy *px)
|
||||
*/
|
||||
static void stats_dump_html_px_end(struct stconn *cs, struct proxy *px)
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
|
||||
chunk_appendf(&trash, "</table>");
|
||||
@ -3016,7 +3016,7 @@ static void stats_dump_html_px_end(struct stconn *cs, struct proxy *px)
|
||||
int stats_dump_proxy_to_buffer(struct stconn *cs, struct htx *htx,
|
||||
struct proxy *px, struct uri_auth *uri)
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct channel *rep = sc_ic(cs);
|
||||
@ -3394,7 +3394,7 @@ static void stats_dump_html_head(struct appctx *appctx, struct uri_auth *uri)
|
||||
*/
|
||||
static void stats_dump_html_info(struct stconn *cs, struct uri_auth *uri)
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
unsigned int up = (now.tv_sec - start_date.tv_sec);
|
||||
char scope_txt[STAT_SCOPE_TXT_MAXLEN + sizeof STAT_SCOPE_PATTERN];
|
||||
@ -3677,7 +3677,7 @@ static int stats_dump_proxies(struct stconn *cs,
|
||||
struct htx *htx,
|
||||
struct uri_auth *uri)
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
struct channel *rep = sc_ic(cs);
|
||||
struct proxy *px;
|
||||
@ -3725,7 +3725,7 @@ static int stats_dump_proxies(struct stconn *cs,
|
||||
static int stats_dump_stat_to_buffer(struct stconn *cs, struct htx *htx,
|
||||
struct uri_auth *uri)
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
struct channel *rep = sc_ic(cs);
|
||||
enum stats_domain domain = ctx->domain;
|
||||
@ -3828,7 +3828,7 @@ static int stats_dump_stat_to_buffer(struct stconn *cs, struct htx *htx,
|
||||
static int stats_process_http_post(struct stconn *cs)
|
||||
{
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
|
||||
struct proxy *px = NULL;
|
||||
@ -4165,7 +4165,7 @@ static int stats_send_http_headers(struct stconn *cs, struct htx *htx)
|
||||
{
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct uri_auth *uri = s->be->uri_auth;
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
struct htx_sl *sl;
|
||||
unsigned int flags;
|
||||
@ -4220,7 +4220,7 @@ static int stats_send_http_redirect(struct stconn *cs, struct htx *htx)
|
||||
char scope_txt[STAT_SCOPE_TXT_MAXLEN + sizeof STAT_SCOPE_PATTERN];
|
||||
struct stream *s = __sc_strm(cs);
|
||||
struct uri_auth *uri = s->be->uri_auth;
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
struct htx_sl *sl;
|
||||
unsigned int flags;
|
||||
@ -4550,7 +4550,7 @@ int stats_fill_info(struct field *info, int len, uint flags)
|
||||
*/
|
||||
static int stats_dump_info_to_buffer(struct stconn *cs)
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_stat_ctx *ctx = appctx->svcctx;
|
||||
|
||||
if (!stats_fill_info(info, INF_TOTAL_FIELDS, ctx->flags))
|
||||
|
||||
22
src/stream.c
22
src/stream.c
@ -536,7 +536,7 @@ struct stream *stream_new(struct session *sess, struct stconn *cs, struct buffer
|
||||
goto out_fail_accept;
|
||||
|
||||
/* finish initialization of the accepted file descriptor */
|
||||
if (cs_appctx(cs))
|
||||
if (sc_appctx(cs))
|
||||
cs_want_get(s->scf);
|
||||
|
||||
if (sess->fe->accept && sess->fe->accept(s) < 0)
|
||||
@ -1002,7 +1002,7 @@ enum act_return process_use_service(struct act_rule *rule, struct proxy *px,
|
||||
return ACT_RET_ERR;
|
||||
}
|
||||
else
|
||||
appctx = __cs_appctx(s->scb);
|
||||
appctx = __sc_appctx(s->scb);
|
||||
|
||||
if (rule->from != ACT_F_HTTP_REQ) {
|
||||
if (sess->fe == s->be) /* report it if the request was intercepted by the frontend */
|
||||
@ -1542,15 +1542,15 @@ static void stream_update_both_cs(struct stream *s)
|
||||
/* stream connectors are processed outside of process_stream() and must be
|
||||
* handled at the latest moment.
|
||||
*/
|
||||
if (cs_appctx(scf)) {
|
||||
if (sc_appctx(scf)) {
|
||||
if ((cs_rx_endp_ready(scf) && !cs_rx_blocked(scf)) ||
|
||||
(cs_tx_endp_ready(scf) && !cs_tx_blocked(scf)))
|
||||
appctx_wakeup(__cs_appctx(scf));
|
||||
appctx_wakeup(__sc_appctx(scf));
|
||||
}
|
||||
if (cs_appctx(scb)) {
|
||||
if (sc_appctx(scb)) {
|
||||
if ((cs_rx_endp_ready(scb) && !cs_rx_blocked(scb)) ||
|
||||
(cs_tx_endp_ready(scb) && !cs_tx_blocked(scb)))
|
||||
appctx_wakeup(__cs_appctx(scb));
|
||||
appctx_wakeup(__sc_appctx(scb));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2755,7 +2755,7 @@ void stream_dump(struct buffer *buf, const struct stream *s, const char *pfx, ch
|
||||
|
||||
scf = s->scf;
|
||||
cof = sc_conn(scf);
|
||||
acf = cs_appctx(scf);
|
||||
acf = sc_appctx(scf);
|
||||
if (cof && cof->src && addr_to_str(cof->src, pn, sizeof(pn)) >= 0)
|
||||
src = pn;
|
||||
else if (acf)
|
||||
@ -2763,7 +2763,7 @@ void stream_dump(struct buffer *buf, const struct stream *s, const char *pfx, ch
|
||||
|
||||
scb = s->scb;
|
||||
cob = sc_conn(scb);
|
||||
acb = cs_appctx(scb);
|
||||
acb = sc_appctx(scb);
|
||||
srv = objt_server(s->target);
|
||||
if (srv)
|
||||
dst = srv->id;
|
||||
@ -3152,7 +3152,7 @@ struct show_sess_ctx {
|
||||
*/
|
||||
static int stats_dump_full_strm_to_buffer(struct stconn *cs, struct stream *strm)
|
||||
{
|
||||
struct appctx *appctx = __cs_appctx(cs);
|
||||
struct appctx *appctx = __sc_appctx(cs);
|
||||
struct show_sess_ctx *ctx = appctx->svcctx;
|
||||
struct stconn *scf, *scb;
|
||||
struct tm tm;
|
||||
@ -3330,7 +3330,7 @@ static int stats_dump_full_strm_to_buffer(struct stconn *cs, struct stream *strm
|
||||
conn_fd(conn) >= 0 ? fdtab[conn->handle.fd].thread_mask: 0);
|
||||
|
||||
}
|
||||
else if ((tmpctx = cs_appctx(scf)) != NULL) {
|
||||
else if ((tmpctx = sc_appctx(scf)) != NULL) {
|
||||
chunk_appendf(&trash,
|
||||
" app0=%p st0=%d st1=%d st2=%d applet=%s tmask=0x%lx nice=%d calls=%u rate=%u cpu=%llu lat=%llu\n",
|
||||
tmpctx,
|
||||
@ -3369,7 +3369,7 @@ static int stats_dump_full_strm_to_buffer(struct stconn *cs, struct stream *strm
|
||||
conn_fd(conn) >= 0 ? fdtab[conn->handle.fd].thread_mask: 0);
|
||||
|
||||
}
|
||||
else if ((tmpctx = cs_appctx(scb)) != NULL) {
|
||||
else if ((tmpctx = sc_appctx(scb)) != NULL) {
|
||||
chunk_appendf(&trash,
|
||||
" app1=%p st0=%d st1=%d st2=%d applet=%s tmask=0x%lx nice=%d calls=%u rate=%u cpu=%llu lat=%llu\n",
|
||||
tmpctx,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user