]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: applet: remove the unneeded appctx->owner
authorWilly Tarreau <w@1wt.eu>
Wed, 11 May 2022 12:09:57 +0000 (14:09 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 13 May 2022 12:28:48 +0000 (14:28 +0200)
This one is the pointer to the conn_stream which is always in the
endpoint that is always present in the appctx, thus it's not needed.
This patch removes it and replaces it with appctx_cs() instead. A
few occurences that were using __cs_strm(appctx->owner) were moved
directly to appctx_strm() which does the equivalent.

28 files changed:
addons/promex/service-prometheus.c
include/haproxy/applet-t.h
src/activity.c
src/applet.c
src/cache.c
src/cli.c
src/conn_stream.c
src/debug.c
src/dns.c
src/flt_spoe.c
src/hlua.c
src/http_client.c
src/log.c
src/map.c
src/mworker.c
src/peers.c
src/pool.c
src/proxy.c
src/resolvers.c
src/ring.c
src/server.c
src/sink.c
src/ssl_ckch.c
src/ssl_crtlist.c
src/ssl_sock.c
src/stats.c
src/stick_table.c
src/stream.c

index fb2fd9ce9fec98d82162af5572e6e08c03ceb3a1..8422e54f6902dfc0506893343b74681fe630ef84 100644 (file)
@@ -558,7 +558,7 @@ static int promex_dump_global_metrics(struct appctx *appctx, struct htx *htx)
        static struct ist prefix = IST("haproxy_process_");
        struct promex_ctx *ctx = appctx->svcctx;
        struct field val;
-       struct channel *chn = cs_ic(appctx->owner);
+       struct channel *chn = cs_ic(appctx_cs(appctx));
        struct ist out = ist2(trash.area, 0);
        size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
        int ret = 1;
@@ -610,7 +610,7 @@ static int promex_dump_front_metrics(struct appctx *appctx, struct htx *htx)
        struct promex_ctx *ctx = appctx->svcctx;
        struct proxy *px;
        struct field val;
-       struct channel *chn = cs_ic(appctx->owner);
+       struct channel *chn = cs_ic(appctx_cs(appctx));
        struct ist out = ist2(trash.area, 0);
        size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
        struct field *stats = stat_l[STATS_DOMAIN_PROXY];
@@ -711,7 +711,7 @@ static int promex_dump_listener_metrics(struct appctx *appctx, struct htx *htx)
        struct promex_ctx *ctx = appctx->svcctx;
        struct proxy *px;
        struct field val;
-       struct channel *chn = cs_ic(appctx->owner);
+       struct channel *chn = cs_ic(appctx_cs(appctx));
        struct ist out = ist2(trash.area, 0);
        size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
        struct field *stats = stat_l[STATS_DOMAIN_PROXY];
@@ -803,7 +803,7 @@ static int promex_dump_back_metrics(struct appctx *appctx, struct htx *htx)
        struct proxy *px;
        struct server *sv;
        struct field val;
-       struct channel *chn = cs_ic(appctx->owner);
+       struct channel *chn = cs_ic(appctx_cs(appctx));
        struct ist out = ist2(trash.area, 0);
        size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
        struct field *stats = stat_l[STATS_DOMAIN_PROXY];
@@ -957,7 +957,7 @@ static int promex_dump_srv_metrics(struct appctx *appctx, struct htx *htx)
        struct proxy *px;
        struct server *sv;
        struct field val;
-       struct channel *chn = cs_ic(appctx->owner);
+       struct channel *chn = cs_ic(appctx_cs(appctx));
        struct ist out = ist2(trash.area, 0);
        size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
        struct field *stats = stat_l[STATS_DOMAIN_PROXY];
@@ -1127,7 +1127,7 @@ static int promex_dump_sticktable_metrics(struct appctx *appctx, struct htx *htx
        static struct ist prefix = IST("haproxy_sticktable_");
        struct promex_ctx *ctx = appctx->svcctx;
        struct field val;
-       struct channel *chn = cs_ic(appctx->owner);
+       struct channel *chn = cs_ic(appctx_cs(appctx));
        struct ist out = ist2(trash.area, 0);
        size_t max = htx_get_max_blksz(htx, channel_htx_recv_max(chn, htx));
        int ret = 1;
@@ -1503,7 +1503,7 @@ static int promex_appctx_init(struct appctx *appctx)
 /* The main I/O handler for the promex applet. */
 static void promex_appctx_handle_io(struct appctx *appctx)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct stream *s = __cs_strm(cs);
        struct channel *req = cs_oc(cs);
        struct channel *res = cs_ic(cs);
index 678742ce34d5b171f69ace593af3ea4342f23a7b..e7823e1367dacea40bd47b8010b74cf4337e4cdf 100644 (file)
@@ -61,7 +61,6 @@ struct appctx {
        unsigned int st1;          /* prompt/payload (bitwise OR of APPCTX_CLI_ST1_*) for stats, session error for peers */
        struct buffer *chunk;       /* used to store unfinished commands */
        struct applet *applet;     /* applet this context refers to */
-       struct conn_stream *owner;
        struct cs_endpoint *endp;
        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 */
index 022b6b33215802473ac3f798680471727f75d1bf..2638022d4794351a90ea3bd9b23f02854466719a 100644 (file)
@@ -621,7 +621,7 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
        unsigned long long tot_alloc_calls, tot_free_calls;
        unsigned long long tot_alloc_bytes, tot_free_bytes;
 #endif
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct buffer *name_buffer = get_trash_chunk();
        const char *str;
        int max_lines;
@@ -849,7 +849,7 @@ static int cli_parse_show_profiling(char **args, char *payload, struct appctx *a
 static int cli_io_handler_show_tasks(struct appctx *appctx)
 {
        struct sched_activity tmp_activity[256] __attribute__((aligned(64)));
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct buffer *name_buffer = get_trash_chunk();
        struct sched_activity *entry;
        const struct tasklet *tl;
index 35fd8e1a2e551cc71c3d443464a0d4c236f20435..9e15c7eb77b6fd157f482c28ec5247460841a493 100644 (file)
@@ -117,7 +117,7 @@ void appctx_shut(struct appctx *appctx)
 int appctx_buf_available(void *arg)
 {
        struct appctx *appctx = arg;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
 
        /* allocation requested ? */
        if (!(appctx->endp->flags & CS_EP_RXBLK_BUFF))
@@ -143,7 +143,7 @@ int appctx_buf_available(void *arg)
 struct task *task_run_applet(struct task *t, void *context, unsigned int state)
 {
        struct appctx *app = context;
-       struct conn_stream *cs = app->owner;
+       struct conn_stream *cs = appctx_cs(app);
        unsigned int rate;
        size_t count;
 
index 2e5c5a45bdf76caac17d32b7f3f868f28c44ee02..dfe8863b3bb061557f5aaf0083c115fc1e435413 100644 (file)
@@ -1293,7 +1293,8 @@ static unsigned int htx_cache_dump_blk(struct appctx *appctx, struct htx *htx, e
        unsigned int max, total;
        uint32_t blksz;
 
-       max = htx_get_max_blksz(htx, channel_htx_recv_max(cs_ic(appctx->owner), htx));
+       max = htx_get_max_blksz(htx,
+                               channel_htx_recv_max(cs_ic(appctx_cs(appctx)), htx));
        if (!max)
                return 0;
        blksz = ((type == HTX_BLK_HDR || type == HTX_BLK_TLR)
@@ -1336,7 +1337,8 @@ static unsigned int htx_cache_dump_data_blk(struct appctx *appctx, struct htx *h
        unsigned int max, total, rem_data;
        uint32_t blksz;
 
-       max = htx_get_max_blksz(htx, channel_htx_recv_max(cs_ic(appctx->owner), htx));
+       max = htx_get_max_blksz(htx,
+                               channel_htx_recv_max(cs_ic(appctx_cs(appctx)), htx));
        if (!max)
                return 0;
 
@@ -1453,7 +1455,7 @@ static void http_cache_io_handler(struct appctx *appctx)
        struct cache_appctx *ctx = appctx->svcctx;
        struct cache_entry *cache_ptr = ctx->entry;
        struct shared_block *first = block_ptr(cache_ptr);
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct channel *req = cs_oc(cs);
        struct channel *res = cs_ic(cs);
        struct htx *req_htx, *res_htx;
@@ -2598,7 +2600,7 @@ static int cli_io_handler_show_cache(struct appctx *appctx)
 {
        struct show_cache_ctx *ctx = appctx->svcctx;
        struct cache* cache = ctx->cache;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
 
        list_for_each_entry_from(cache, &caches, list) {
                struct eb32_node *node = NULL;
index 30d24b8d3ac6d09ded9b8c091e2af3fb1cec7b81..b53393877232fb06a8c6c45c98ff125015084ee2 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -722,7 +722,7 @@ static int cli_get_severity_output(struct appctx *appctx)
 {
        if (appctx->cli_severity_output)
                return appctx->cli_severity_output;
-       return strm_li(__cs_strm(appctx->owner))->bind_conf->severity_output;
+       return strm_li(appctx_strm(appctx))->bind_conf->severity_output;
 }
 
 /* Processes the CLI interpreter on the stats socket. This function is called
@@ -897,7 +897,7 @@ static int cli_output_msg(struct channel *chn, const char *msg, int severity, in
  */
 static void cli_io_handler(struct appctx *appctx)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct channel *req = cs_oc(cs);
        struct channel *res = cs_ic(cs);
        struct bind_conf *bind_conf = strm_li(__cs_strm(cs))->bind_conf;
@@ -1226,7 +1226,7 @@ static void cli_release_handler(struct appctx *appctx)
 static int cli_io_handler_show_env(struct appctx *appctx)
 {
        struct show_env_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        char **var = ctx->var;
 
        if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
@@ -1262,7 +1262,7 @@ static int cli_io_handler_show_env(struct appctx *appctx)
  */
 static int cli_io_handler_show_fd(struct appctx *appctx)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct show_fd_ctx *fdctx = appctx->svcctx;
        int fd = fdctx->fd;
        int ret = 1;
@@ -1462,7 +1462,7 @@ static int cli_io_handler_show_fd(struct appctx *appctx)
  */
 static int cli_io_handler_show_activity(struct appctx *appctx)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        int thr;
 
        if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
@@ -1567,7 +1567,7 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx)
 {
        struct show_sock_ctx *ctx = applet_reserve_svcctx(appctx, sizeof(*ctx));
        struct bind_conf *bind_conf = ctx->bind_conf;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
 
        if (!global.cli_fe)
                goto done;
@@ -1693,7 +1693,7 @@ static int cli_parse_show_fd(char **args, char *payload, struct appctx *appctx,
 /* parse a "set timeout" CLI request. It always returns 1. */
 static int cli_parse_set_timeout(char **args, char *payload, struct appctx *appctx, void *private)
 {
-       struct stream *s = __cs_strm(appctx->owner);
+       struct stream *s = appctx_strm(appctx);
 
        if (strcmp(args[2], "cli") == 0) {
                unsigned timeout;
@@ -1976,7 +1976,7 @@ static int _getsocks(char **args, char *payload, struct appctx *appctx, void *pr
        char *cmsgbuf = NULL;
        unsigned char *tmpbuf = NULL;
        struct cmsghdr *cmsg;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct stream *s = __cs_strm(cs);
        struct connection *remote = cs_conn(cs_opposite(cs));
        struct msghdr msghdr;
index ff8704f5f305f1257e88160faaf3669b3b264433..c13a2a1d1a83305d4562a46b2077a2049075e313 100644 (file)
@@ -179,12 +179,10 @@ struct conn_stream *cs_new_from_mux(struct cs_endpoint *endp, struct session *se
 struct conn_stream *cs_new_from_applet(struct cs_endpoint *endp, struct session *sess, struct buffer *input)
 {
        struct conn_stream *cs;
-       struct appctx *appctx = endp->ctx;
 
        cs = cs_new(endp);
        if (unlikely(!cs))
                return NULL;
-       appctx->owner = cs;
        if (unlikely(!stream_new(sess, cs, input))) {
                pool_free(pool_head_connstream, cs);
                cs = NULL;
@@ -300,13 +298,10 @@ int cs_attach_mux(struct conn_stream *cs, void *target, void *ctx)
  */
 static void cs_attach_applet(struct conn_stream *cs, void *target, void *ctx)
 {
-       struct appctx *appctx = target;
-
        cs->endp->target = target;
        cs->endp->ctx = ctx;
        cs->endp->flags |= CS_EP_T_APPLET;
        cs->endp->flags &= ~CS_EP_DETACHED;
-       appctx->owner = cs;
        if (cs_strm(cs)) {
                cs->ops = &cs_app_applet_ops;
                cs->data_cb = &cs_data_applet_cb;
@@ -505,7 +500,6 @@ struct appctx *cs_applet_create(struct conn_stream *cs, struct applet *app)
        if (!appctx)
                return NULL;
        cs_attach_applet(cs, appctx, appctx);
-       appctx->owner = cs;
        appctx->t->nice = __cs_strm(cs)->task->nice;
        cs_cant_get(cs);
        appctx_wakeup(appctx);
index db7dcbed791bc15c64446bb564f9338727f0789d..858311183335c519be132f7827c593ea56d85a0e 100644 (file)
@@ -251,7 +251,7 @@ void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx)
        if (task->process == process_stream && task->context)
                s = (struct stream *)task->context;
        else if (task->process == task_run_applet && task->context)
-               s = cs_strm(((struct appctx *)task->context)->owner);
+               s = cs_strm(appctx_cs((struct appctx *)task->context));
        else if (task->process == cs_conn_io_cb && task->context)
                s = cs_strm(((struct conn_stream *)task->context));
 
@@ -290,7 +290,7 @@ void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx)
  */
 static int cli_io_handler_show_threads(struct appctx *appctx)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        int thr;
 
        if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
@@ -676,7 +676,7 @@ static int debug_parse_cli_write(char **args, char *payload, struct appctx *appc
  */
 static int debug_parse_cli_stream(char **args, char *payload, struct appctx *appctx, void *private)
 {
-       struct stream *s = __cs_strm(appctx->owner);
+       struct stream *s = appctx_strm(appctx);
        int arg;
        void *ptr;
        int size;
@@ -1044,7 +1044,7 @@ static int debug_parse_cli_fd(char **args, char *payload, struct appctx *appctx,
 static int debug_iohandler_fd(struct appctx *appctx)
 {
        struct dev_fd_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct sockaddr_storage sa;
        struct stat statbuf;
        socklen_t salen, vlen;
@@ -1239,7 +1239,7 @@ static int debug_parse_cli_memstats(char **args, char *payload, struct appctx *a
 static int debug_iohandler_memstats(struct appctx *appctx)
 {
        struct dev_mem_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct mem_stats *ptr = ctx->start;
        int ret = 1;
 
index 712cc564eb5b14d260d4ea0231f694845ffe7cbc..35ff61a6ad8141f30480efea7e3a265d7fd75955 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -438,7 +438,7 @@ out:
  */
 static void dns_session_io_handler(struct appctx *appctx)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct dns_session *ds = appctx->svcctx;
        struct ring *ring = &ds->ring;
        struct buffer *buf = &ring->buf;
index f032e83059e49465f65caba52a89074e6d242b9c..59db4280e0672703a5a6454a353fbad89859fd08 100644 (file)
@@ -1137,7 +1137,7 @@ spoe_handle_healthcheck_response(char *frame, size_t size, char *err, int errlen
 static int
 spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        int      ret;
        uint32_t netint;
 
@@ -1163,7 +1163,7 @@ spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz)
 static int
 spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        int      ret;
        uint32_t netint;
 
@@ -1192,8 +1192,8 @@ spoe_recv_frame(struct appctx *appctx, char *buf, size_t framesz)
 static int
 spoe_wakeup_appctx(struct appctx *appctx)
 {
-       cs_want_get(appctx->owner);
-       cs_rx_endp_more(appctx->owner);
+       cs_want_get(appctx_cs(appctx));
+       cs_rx_endp_more(appctx_cs(appctx));
        appctx_wakeup(appctx);
        return 1;
 }
@@ -1219,7 +1219,7 @@ spoe_process_appctx(struct task * task, void *context, unsigned int state)
 static void
 spoe_release_appctx(struct appctx *appctx)
 {
-       struct conn_stream  *cs          = appctx->owner;
+       struct conn_stream  *cs          = appctx_cs(appctx);
        struct spoe_appctx  *spoe_appctx = SPOE_APPCTX(appctx);
        struct spoe_agent   *agent;
        struct spoe_context *ctx, *back;
@@ -1339,7 +1339,7 @@ spoe_release_appctx(struct appctx *appctx)
 static int
 spoe_handle_connect_appctx(struct appctx *appctx)
 {
-       struct conn_stream *cs    = appctx->owner;
+       struct conn_stream *cs    = appctx_cs(appctx);
        struct spoe_agent  *agent = SPOE_APPCTX(appctx)->agent;
        char *frame, *buf;
        int   ret;
@@ -1405,7 +1405,7 @@ spoe_handle_connect_appctx(struct appctx *appctx)
 static int
 spoe_handle_connecting_appctx(struct appctx *appctx)
 {
-       struct conn_stream *cs     = appctx->owner;
+       struct conn_stream *cs     = appctx_cs(appctx);
        struct spoe_agent  *agent  = SPOE_APPCTX(appctx)->agent;
        char  *frame;
        int    ret;
@@ -1650,7 +1650,7 @@ spoe_handle_receiving_frame_appctx(struct appctx *appctx, int *skip)
 
        /* Do not forget to remove processed frame from the output buffer */
        if (trash.data)
-               co_skip(cs_oc(appctx->owner), trash.data);
+               co_skip(cs_oc(appctx_cs(appctx)), trash.data);
   end:
        return ret;
 }
@@ -1658,7 +1658,7 @@ spoe_handle_receiving_frame_appctx(struct appctx *appctx, int *skip)
 static int
 spoe_handle_processing_appctx(struct appctx *appctx)
 {
-       struct conn_stream      *cs    = appctx->owner;
+       struct conn_stream      *cs    = appctx_cs(appctx);
        struct server           *srv   = objt_server(__cs_strm(cs)->target);
        struct spoe_agent       *agent = SPOE_APPCTX(appctx)->agent;
        int ret, skip_sending = 0, skip_receiving = 0, active_s = 0, active_r = 0, close_asap = 0;
@@ -1781,7 +1781,7 @@ spoe_handle_processing_appctx(struct appctx *appctx)
 static int
 spoe_handle_disconnect_appctx(struct appctx *appctx)
 {
-       struct conn_stream *cs    = appctx->owner;
+       struct conn_stream *cs    = appctx_cs(appctx);
        struct spoe_agent  *agent = SPOE_APPCTX(appctx)->agent;
        char *frame, *buf;
        int   ret;
@@ -1834,7 +1834,7 @@ spoe_handle_disconnect_appctx(struct appctx *appctx)
 static int
 spoe_handle_disconnecting_appctx(struct appctx *appctx)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        char  *frame;
        int    ret;
 
@@ -1899,7 +1899,7 @@ spoe_handle_disconnecting_appctx(struct appctx *appctx)
 static void
 spoe_handle_appctx(struct appctx *appctx)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct spoe_agent  *agent;
 
        if (SPOE_APPCTX(appctx) == NULL)
index 8d6fc35e27689359accb5c760dfac6d5a7e14a32..91a9f7cad244f9182c6047ac196950fc35497d1b 100644 (file)
@@ -1943,7 +1943,7 @@ __LJMP static struct hlua_socket *hlua_checksocket(lua_State *L, int ud)
 static void hlua_socket_handler(struct appctx *appctx)
 {
        struct hlua_csk_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
 
        if (ctx->die) {
                cs_shutw(cs);
@@ -2143,7 +2143,7 @@ __LJMP static int hlua_socket_receive_yield(struct lua_State *L, int status, lua
 
        csk_ctx = container_of(peer, struct hlua_csk_ctx, xref);
        appctx = csk_ctx->appctx;
-       s = __cs_strm(appctx->owner);
+       s = appctx_strm(appctx);
 
        oc = &s->res;
        if (wanted == HLSR_READ_LINE) {
@@ -2384,7 +2384,7 @@ static int hlua_socket_write_yield(struct lua_State *L,int status, lua_KContext
 
        csk_ctx = container_of(peer, struct hlua_csk_ctx, xref);
        appctx = csk_ctx->appctx;
-       cs = appctx->owner;
+       cs = appctx_cs(appctx);
        s = __cs_strm(cs);
 
        /* Check for connection close. */
@@ -2618,7 +2618,7 @@ __LJMP static int hlua_socket_getpeername(struct lua_State *L)
        }
 
        appctx = container_of(peer, struct hlua_csk_ctx, xref)->appctx;
-       cs = appctx->owner;
+       cs = appctx_cs(appctx);
        dst = cs_dst(cs_opposite(cs));
        if (!dst) {
                xref_unlock(&socket->xref, peer);
@@ -2659,7 +2659,7 @@ static int hlua_socket_getsockname(struct lua_State *L)
        }
 
        appctx = container_of(peer, struct hlua_csk_ctx, xref)->appctx;
-       s = __cs_strm(appctx->owner);
+       s = appctx_strm(appctx);
 
        conn = cs_conn(s->csb);
        if (!conn || !conn_get_src(conn)) {
@@ -2711,7 +2711,7 @@ __LJMP static int hlua_socket_connect_yield(struct lua_State *L, int status, lua
 
        csk_ctx = container_of(peer, struct hlua_csk_ctx, xref);
        appctx = csk_ctx->appctx;
-       s = __cs_strm(appctx->owner);
+       s = appctx_strm(appctx);
 
        /* Check if we run on the same thread than the xreator thread.
         * We cannot access to the socket if the thread is different.
@@ -2824,7 +2824,7 @@ __LJMP static int hlua_socket_connect(struct lua_State *L)
 
        csk_ctx = container_of(peer, struct hlua_csk_ctx, xref);
        appctx = csk_ctx->appctx;
-       cs = appctx->owner;
+       cs = appctx_cs(appctx);
        s = __cs_strm(cs);
 
        if (!sockaddr_alloc(&cs_opposite(cs)->dst, addr, sizeof(*addr))) {
@@ -2865,7 +2865,6 @@ __LJMP static int hlua_socket_connect_ssl(struct lua_State *L)
 {
        struct hlua_socket *socket;
        struct xref *peer;
-       struct appctx *appctx;
        struct stream *s;
 
        MAY_LJMP(check_args(L, 3, "connect_ssl"));
@@ -2878,8 +2877,7 @@ __LJMP static int hlua_socket_connect_ssl(struct lua_State *L)
                return 1;
        }
 
-       appctx = container_of(peer, struct hlua_csk_ctx, xref)->appctx;
-       s = __cs_strm(appctx->owner);
+       s = appctx_strm(container_of(peer, struct hlua_csk_ctx, xref)->appctx);
 
        s->target = &socket_ssl->obj_type;
        xref_unlock(&socket->xref, peer);
@@ -2898,7 +2896,6 @@ __LJMP static int hlua_socket_settimeout(struct lua_State *L)
        int tmout;
        double dtmout;
        struct xref *peer;
-       struct appctx *appctx;
        struct stream *s;
 
        MAY_LJMP(check_args(L, 2, "settimeout"));
@@ -2933,8 +2930,7 @@ __LJMP static int hlua_socket_settimeout(struct lua_State *L)
                return 0;
        }
 
-       appctx = container_of(peer, struct hlua_csk_ctx, xref)->appctx;
-       s = __cs_strm(appctx->owner);
+       s = appctx_strm(container_of(peer, struct hlua_csk_ctx, xref)->appctx);
 
        s->sess->fe->timeout.connect = tmout;
        s->req.rto = tmout;
@@ -4310,7 +4306,7 @@ __LJMP static struct hlua_appctx *hlua_checkapplet_tcp(lua_State *L, int ud)
 static int hlua_applet_tcp_new(lua_State *L, struct appctx *ctx)
 {
        struct hlua_appctx *luactx;
-       struct stream *s = __cs_strm(ctx->owner);
+       struct stream *s = appctx_strm(ctx);
        struct proxy *p;
 
        ALREADY_CHECKED(s);
@@ -4493,7 +4489,7 @@ __LJMP static int hlua_applet_tcp_get_priv(lua_State *L)
 __LJMP static int hlua_applet_tcp_getline_yield(lua_State *L, int status, lua_KContext ctx)
 {
        struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_tcp(L, 1));
-       struct conn_stream *cs = luactx->appctx->owner;
+       struct conn_stream *cs = appctx_cs(luactx->appctx);
        int ret;
        const char *blk1;
        size_t len1;
@@ -4547,7 +4543,7 @@ __LJMP static int hlua_applet_tcp_getline(lua_State *L)
 __LJMP static int hlua_applet_tcp_recv_yield(lua_State *L, int status, lua_KContext ctx)
 {
        struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_tcp(L, 1));
-       struct conn_stream *cs = luactx->appctx->owner;
+       struct conn_stream *cs = appctx_cs(luactx->appctx);
        size_t len = MAY_LJMP(luaL_checkinteger(L, 2));
        int ret;
        const char *blk1;
@@ -4655,7 +4651,7 @@ __LJMP static int hlua_applet_tcp_send_yield(lua_State *L, int status, lua_KCont
        struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_tcp(L, 1));
        const char *str = MAY_LJMP(luaL_checklstring(L, 2, &len));
        int l = MAY_LJMP(luaL_checkinteger(L, 3));
-       struct conn_stream *cs = luactx->appctx->owner;
+       struct conn_stream *cs = appctx_cs(luactx->appctx);
        struct channel *chn = cs_ic(cs);
        int max;
 
@@ -4721,7 +4717,7 @@ static int hlua_applet_http_new(lua_State *L, struct appctx *ctx)
        struct hlua_http_ctx *http_ctx = ctx->svcctx;
        struct hlua_appctx *luactx;
        struct hlua_txn htxn;
-       struct stream *s = __cs_strm(ctx->owner);
+       struct stream *s = appctx_strm(ctx);
        struct proxy *px = s->be;
        struct htx *htx;
        struct htx_blk *blk;
@@ -4982,7 +4978,7 @@ __LJMP static int hlua_applet_http_get_priv(lua_State *L)
 __LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_KContext ctx)
 {
        struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
-       struct conn_stream *cs = luactx->appctx->owner;
+       struct conn_stream *cs = appctx_cs(luactx->appctx);
        struct channel *req = cs_oc(cs);
        struct htx *htx;
        struct htx_blk *blk;
@@ -5077,7 +5073,7 @@ __LJMP static int hlua_applet_http_getline(lua_State *L)
 __LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KContext ctx)
 {
        struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
-       struct conn_stream *cs = luactx->appctx->owner;
+       struct conn_stream *cs = appctx_cs(luactx->appctx);
        struct channel *req = cs_oc(cs);
        struct htx *htx;
        struct htx_blk *blk;
@@ -5186,7 +5182,7 @@ __LJMP static int hlua_applet_http_recv(lua_State *L)
 __LJMP static int hlua_applet_http_send_yield(lua_State *L, int status, lua_KContext ctx)
 {
        struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
-       struct conn_stream *cs = luactx->appctx->owner;
+       struct conn_stream *cs = appctx_cs(luactx->appctx);
        struct channel *res = cs_ic(cs);
        struct htx *htx = htx_from_buf(&res->buf);
        const char *data;
@@ -5323,7 +5319,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L)
 {
        struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
        struct hlua_http_ctx *http_ctx = luactx->appctx->svcctx;
-       struct conn_stream *cs = luactx->appctx->owner;
+       struct conn_stream *cs = appctx_cs(luactx->appctx);
        struct channel *res = cs_ic(cs);
        struct htx *htx;
        struct htx_sl *sl;
@@ -5520,7 +5516,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L)
 __LJMP static int hlua_applet_http_start_response_yield(lua_State *L, int status, lua_KContext ctx)
 {
        struct hlua_appctx *luactx = MAY_LJMP(hlua_checkapplet_http(L, 1));
-       struct conn_stream *cs = luactx->appctx->owner;
+       struct conn_stream *cs = appctx_cs(luactx->appctx);
        struct channel *res = cs_ic(cs);
 
        if (co_data(res)) {
@@ -9230,7 +9226,7 @@ struct task *hlua_applet_wakeup(struct task *t, void *context, unsigned int stat
 static int hlua_applet_tcp_init(struct appctx *ctx)
 {
        struct hlua_tcp_ctx *tcp_ctx = applet_reserve_svcctx(ctx, sizeof(*tcp_ctx));
-       struct conn_stream *cs = ctx->owner;
+       struct conn_stream *cs = appctx_cs(ctx);
        struct stream *strm = __cs_strm(cs);
        struct hlua *hlua;
        struct task *task;
@@ -9328,7 +9324,7 @@ static int hlua_applet_tcp_init(struct appctx *ctx)
 void hlua_applet_tcp_fct(struct appctx *ctx)
 {
        struct hlua_tcp_ctx *tcp_ctx = ctx->svcctx;
-       struct conn_stream *cs = ctx->owner;
+       struct conn_stream *cs = appctx_cs(ctx);
        struct stream *strm = __cs_strm(cs);
        struct channel *res = cs_ic(cs);
        struct act_rule *rule = ctx->rule;
@@ -9422,7 +9418,7 @@ static void hlua_applet_tcp_release(struct appctx *ctx)
 static int hlua_applet_http_init(struct appctx *ctx)
 {
        struct hlua_http_ctx *http_ctx = applet_reserve_svcctx(ctx, sizeof(*http_ctx));
-       struct conn_stream *cs = ctx->owner;
+       struct conn_stream *cs = appctx_cs(ctx);
        struct stream *strm = __cs_strm(cs);
        struct http_txn *txn;
        struct hlua *hlua;
@@ -9525,7 +9521,7 @@ static int hlua_applet_http_init(struct appctx *ctx)
 void hlua_applet_http_fct(struct appctx *ctx)
 {
        struct hlua_http_ctx *http_ctx = ctx->svcctx;
-       struct conn_stream *cs = ctx->owner;
+       struct conn_stream *cs = appctx_cs(ctx);
        struct stream *strm = __cs_strm(cs);
        struct channel *req = cs_oc(cs);
        struct channel *res = cs_ic(cs);
@@ -10162,7 +10158,7 @@ static int hlua_cli_io_handler_fct(struct appctx *appctx)
        struct hlua_function *fcn;
 
        hlua = ctx->hlua;
-       cs = appctx->owner;
+       cs = appctx_cs(appctx);
        fcn = ctx->fcn;
 
        /* If the stream is disconnect or closed, ldo nothing. */
index bff7057b17384d7d33b36133d77407fdde08bd38..1efb48496d183418891b707a18baf240185aae4e 100644 (file)
@@ -195,7 +195,7 @@ err:
 static int hc_cli_io_handler(struct appctx *appctx)
 {
        struct hcli_svc_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct buffer *trash = alloc_trash_chunk();
        struct httpclient *hc = ctx->hc;
        struct http_hdr *hdrs, *hdr;
@@ -739,7 +739,7 @@ err:
 static void httpclient_applet_io_handler(struct appctx *appctx)
 {
        struct httpclient *hc = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct stream *s = __cs_strm(cs);
        struct channel *req = &s->req;
        struct channel *res = &s->res;
index 522c2f602df063f28bc1cc1c23dccb9f53dd9ad8..be989828b2e8931126c3b69c7ae8a70bd61e537d 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -3559,7 +3559,7 @@ out:
 static void syslog_io_handler(struct appctx *appctx)
 {
        static THREAD_LOCAL struct ist metadata[LOG_META_FIELDS];
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct stream *s = __cs_strm(cs);
        struct proxy *frontend = strm_fe(s);
        struct listener *l = strm_li(s);
index dea9bcdfddc1a7a26652490c52e4e105aba2c114..89bbd9e8023dab5121e1db6d9b07af95c46d34d5 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -345,7 +345,7 @@ struct show_map_ctx {
 static int cli_io_handler_pat_list(struct appctx *appctx)
 {
        struct show_map_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct pat_ref_elt *elt;
 
        if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW))) {
@@ -417,7 +417,7 @@ static int cli_io_handler_pat_list(struct appctx *appctx)
 static int cli_io_handler_pats_list(struct appctx *appctx)
 {
        struct show_map_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
 
        switch (ctx->state) {
        case STATE_INIT:
@@ -480,7 +480,7 @@ static int cli_io_handler_pats_list(struct appctx *appctx)
 static int cli_io_handler_map_lookup(struct appctx *appctx)
 {
        struct show_map_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct sample sample;
        struct pattern *pat;
        int match_method;
@@ -1030,7 +1030,7 @@ static int cli_io_handler_clear_map(struct appctx *appctx)
 
        if (!finished) {
                /* let's come back later */
-               cs_rx_endp_more(appctx->owner);
+               cs_rx_endp_more(appctx_cs(appctx));
                return 0;
        }
        return 1;
index 1ee93fbd53af5af93cc9db427805706fa3f07f1c..24fde3cdeddead7f36438f4f5b87525ed83c5a32 100644 (file)
@@ -509,7 +509,7 @@ void mworker_cleanup_proc()
 /*  Displays workers and processes  */
 static int cli_io_handler_show_proc(struct appctx *appctx)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct mworker_proc *child;
        int old = 0;
        int up = now.tv_sec - proc_self->timestamp;
index 0d91995376d69f41d53aae321d1834e5f13b6fe7..f521b55ea7ce4cc185a64c7d82c6f30d4c107ae8 100644 (file)
@@ -444,7 +444,7 @@ static void peers_trace(enum trace_level level, uint64_t mask,
                        struct peers *peers = NULL;
 
                        if (peer->appctx) {
-                               struct stream *s = __cs_strm(peer->appctx->owner);
+                               struct stream *s = appctx_strm(peer->appctx);
 
                                peers = strm_fe(s)->parent;
                        }
@@ -1043,7 +1043,7 @@ void __peer_session_deinit(struct peer *peer)
        if (!peer->appctx)
                return;
 
-       s = __cs_strm(peer->appctx->owner);
+       s = appctx_strm(peer->appctx);
 
        peers = strm_fe(s)->parent;
        if (!peers)
@@ -1136,7 +1136,7 @@ static int peer_get_version(const char *str,
  */
 static inline int peer_getline(struct appctx  *appctx)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        int n;
 
        n = co_getline(cs_oc(cs), trash.area, trash.size);
@@ -1170,7 +1170,7 @@ static inline int peer_send_msg(struct appctx *appctx,
                                 struct peer_prep_params *params)
 {
        int ret, msglen;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
 
        msglen = peer_prepare_msg(trash.area, trash.size, params);
        if (!msglen) {
@@ -1650,7 +1650,7 @@ static inline int peer_send_teach_stage2_msgs(struct appctx *appctx, struct peer
 static int peer_treat_updatemsg(struct appctx *appctx, struct peer *p, int updt, int exp,
                                 char **msg_cur, char *msg_end, int msg_len, int totl)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct shared_table *st = p->remote_table;
        struct stksess *ts, *newts;
        uint32_t update;
@@ -2102,7 +2102,7 @@ static inline int peer_treat_switchmsg(struct appctx *appctx, struct peer *p,
 static inline int peer_treat_definemsg(struct appctx *appctx, struct peer *p,
                                       char **msg_cur, char *msg_end, int totl)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        int table_id_len;
        struct shared_table *st;
        int table_type;
@@ -2301,7 +2301,7 @@ static inline int peer_recv_msg(struct appctx *appctx, char *msg_head, size_t ms
                                 uint32_t *msg_len, int *totl)
 {
        int reql;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        char *cur;
 
        reql = co_getblk(cs_oc(cs), msg_head, 2 * sizeof(char), *totl);
@@ -2373,7 +2373,7 @@ static inline int peer_recv_msg(struct appctx *appctx, char *msg_head, size_t ms
 static inline int peer_treat_awaited_msg(struct appctx *appctx, struct peer *peer, unsigned char *msg_head,
                                          char **msg_cur, char *msg_end, int msg_len, int totl)
 {
-       struct stream *s = __cs_strm(appctx->owner);
+       struct stream *s = appctx_strm(appctx);
        struct peers *peers = strm_fe(s)->parent;
 
        if (msg_head[0] == PEER_MSG_CLASS_CONTROL) {
@@ -2660,7 +2660,7 @@ static inline int peer_getline_last(struct appctx *appctx, struct peer **curpeer
        char *p;
        int reql;
        struct peer *peer;
-       struct stream *s = __cs_strm(appctx->owner);
+       struct stream *s = appctx_strm(appctx);
        struct peers *peers = strm_fe(s)->parent;
 
        reql = peer_getline(appctx);
@@ -2820,7 +2820,7 @@ static inline void init_connected_peer(struct peer *peer, struct peers *peers)
  */
 static void peer_io_handler(struct appctx *appctx)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct stream *s = __cs_strm(cs);
        struct peers *curpeers = strm_fe(s)->parent;
        struct peer *curpeer = NULL;
@@ -3827,7 +3827,7 @@ static int peers_dump_peer(struct buffer *msg, struct conn_stream *cs, struct pe
        chunk_appendf(&trash, " appctx:%p st0=%d st1=%d task_calls=%u", appctx, appctx->st0, appctx->st1,
                                                                        appctx->t ? appctx->t->calls : 0);
 
-       peer_cs = peer->appctx->owner;
+       peer_cs = appctx_cs(peer->appctx);
        peer_s = __cs_strm(peer_cs);
 
        chunk_appendf(&trash, " state=%s", cs_state_str(cs_opposite(peer_cs)->state));
@@ -3962,7 +3962,7 @@ static int cli_io_handler_show_peers(struct appctx *appctx)
                                        chunk_appendf(&trash, "\n");
                                else
                                        first_peers = 0;
-                               if (!peers_dump_head(&trash, appctx->owner, ctx->peers))
+                               if (!peers_dump_head(&trash, appctx_cs(appctx), ctx->peers))
                                        goto out;
 
                                ctx->peer = ctx->peers->remote;
@@ -3980,7 +3980,7 @@ static int cli_io_handler_show_peers(struct appctx *appctx)
                                        ctx->state = STATE_DONE;
                        }
                        else {
-                               if (!peers_dump_peer(&trash, appctx->owner, ctx->peer, ctx->flags))
+                               if (!peers_dump_peer(&trash, appctx_cs(appctx), ctx->peer, ctx->flags))
                                        goto out;
 
                                ctx->peer = ctx->peer->next;
index 83525311f1741ea6851cbc6fe0633ac33fa3610d..2b4754ec2ba34441d84cc9d71aab67efa3068678 100644 (file)
@@ -1011,7 +1011,7 @@ int pool_parse_debugging(const char *str, char **err)
  */
 static int cli_io_handler_dump_pools(struct appctx *appctx)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
 
        dump_pools_to_trash();
        if (ci_putchk(cs_ic(cs), &trash) == -1) {
index 0badc1121c484c599e5dd296ebd24b47995aa08a..9c856f3a06f3714eb786b2a3189d2df5333cd445 100644 (file)
@@ -2787,7 +2787,7 @@ static int dump_servers_state(struct conn_stream *cs)
 static int cli_io_handler_servers_state(struct appctx *appctx)
 {
        struct show_srv_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct proxy *curproxy;
 
        if (ctx->state == SHOW_SRV_HEAD) {
@@ -2828,7 +2828,7 @@ static int cli_io_handler_servers_state(struct appctx *appctx)
  */
 static int cli_io_handler_show_backend(struct appctx *appctx)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct proxy *curproxy;
 
        chunk_reset(&trash);
@@ -3144,7 +3144,7 @@ static int cli_parse_show_errors(char **args, char *payload, struct appctx *appc
 static int cli_io_handler_show_errors(struct appctx *appctx)
 {
        struct show_errors_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        extern const char *monthname[12];
 
        if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
index e58fa596784d440b74388a7317335da85cbcf70f..aba2d245f7e678c381489a68e4731c44c262c2e2 100644 (file)
@@ -2760,7 +2760,7 @@ static int cli_parse_stat_resolvers(char **args, char *payload, struct appctx *a
 static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx)
 {
        struct show_resolvers_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct resolvers    *resolvers = ctx->resolvers;
        struct dns_nameserver   *ns;
 
index d2c1c4ab2662d88facda333f658adf2197f5950e..33eb62ae2d47e64a9bbe411b5cd29185f516b062 100644 (file)
@@ -290,7 +290,7 @@ int ring_attach_cli(struct ring *ring, struct appctx *appctx, uint flags)
 int cli_io_handler_show_ring(struct appctx *appctx)
 {
        struct show_ring_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct ring *ring = ctx->ring;
        struct buffer *buf = &ring->buf;
        size_t ofs = ctx->ofs;
index a0da6e65f9a68f546a1aa6c3f4285325453f4ba1..fd24ef85b40f440bc50d01c1f6b6eef8ccd65cd5 100644 (file)
@@ -4315,7 +4315,7 @@ static int cli_parse_set_server(char **args, char *payload, struct appctx *appct
 
 static int cli_parse_get_weight(char **args, char *payload, struct appctx *appctx, void *private)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct proxy *px;
        struct server *sv;
        char *line;
index 9f0bfb8bf8d1ff3dd1eee03d2b0d8d394a9eb697..3dc4a4df2ec1cb4b9bec93625975271715ab841b 100644 (file)
@@ -299,7 +299,7 @@ void sink_setup_proxy(struct proxy *px)
  */
 static void sink_forward_io_handler(struct appctx *appctx)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct stream *s = __cs_strm(cs);
        struct sink *sink = strm_fe(s)->parent;
        struct sink_forward_target *sft = appctx->svcctx;
@@ -439,7 +439,7 @@ close:
  */
 static void sink_forward_oc_io_handler(struct appctx *appctx)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct stream *s = __cs_strm(cs);
        struct sink *sink = strm_fe(s)->parent;
        struct sink_forward_target *sft = appctx->svcctx;
@@ -579,7 +579,7 @@ close:
 
 void __sink_forward_session_deinit(struct sink_forward_target *sft)
 {
-       struct stream *s = __cs_strm(sft->appctx->owner);
+       struct stream *s = appctx_strm(sft->appctx);
        struct sink *sink;
 
        sink = strm_fe(s)->parent;
index 6238c7e0a0f5ddc885c3096a4b794d2bf61a8233..20e2dfcd438a24d3fca36c13456bed68ab7283d7 100644 (file)
@@ -1314,7 +1314,7 @@ static int cli_io_handler_show_cert(struct appctx *appctx)
        struct show_cert_ctx *ctx = appctx->svcctx;
        struct buffer *trash = alloc_trash_chunk();
        struct ebmb_node *node;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct ckch_store *ckchs;
 
        if (trash == NULL)
@@ -1716,7 +1716,7 @@ static int ckch_store_show_ocsp_certid(struct ckch_store *ckch_store, struct buf
 static int cli_io_handler_show_cert_detail(struct appctx *appctx)
 {
        struct show_cert_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct ckch_store *ckchs = ctx->cur_ckchs;
        struct buffer *out = alloc_trash_chunk();
        int retval = 0;
@@ -1767,7 +1767,7 @@ static int cli_io_handler_show_cert_ocsp_detail(struct appctx *appctx)
 {
 #if ((defined SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB && !defined OPENSSL_NO_OCSP) && !defined OPENSSL_IS_BORINGSSL)
        struct show_cert_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct ckch_store *ckchs = ctx->cur_ckchs;
        struct buffer *out = alloc_trash_chunk();
        int from_transaction = ctx->transaction;
@@ -2048,7 +2048,7 @@ void ckch_store_replace(struct ckch_store *old_ckchs, struct ckch_store *new_ckc
 static int cli_io_handler_commit_cert(struct appctx *appctx)
 {
        struct commit_cert_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        int y = 0;
        char *err = NULL;
        struct ckch_store *old_ckchs, *new_ckchs = NULL;
@@ -2793,7 +2793,7 @@ static inline int __create_new_instance(struct appctx *appctx, struct ckch_inst
 static int cli_io_handler_commit_cafile_crlfile(struct appctx *appctx)
 {
        struct commit_cacrlfile_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        int y = 0;
        char *err = NULL;
        struct cafile_entry *old_cafile_entry = NULL, *new_cafile_entry = NULL;
@@ -3025,7 +3025,7 @@ static void cli_release_commit_cafile(struct appctx *appctx)
 static int cli_io_handler_show_cafile_detail(struct appctx *appctx)
 {
        struct show_cafile_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct cafile_entry *cafile_entry = ctx->cur_cafile_entry;
        struct buffer *out = alloc_trash_chunk();
        int i = 0;
@@ -3196,7 +3196,7 @@ static int cli_io_handler_show_cafile(struct appctx *appctx)
        struct show_cafile_ctx *ctx = appctx->svcctx;
        struct buffer *trash = alloc_trash_chunk();
        struct ebmb_node *node;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct cafile_entry *cafile_entry;
 
        if (trash == NULL)
@@ -3712,7 +3712,7 @@ end:
 static int cli_io_handler_show_crlfile_detail(struct appctx *appctx)
 {
        struct show_crlfile_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct cafile_entry *cafile_entry = ctx->cafile_entry;
        struct buffer *out = alloc_trash_chunk();
        int i;
@@ -3847,7 +3847,7 @@ static int cli_io_handler_show_crlfile(struct appctx *appctx)
        struct show_crlfile_ctx *ctx = appctx->svcctx;
        struct buffer *trash = alloc_trash_chunk();
        struct ebmb_node *node;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct cafile_entry *cafile_entry;
 
        if (trash == NULL)
index 56d2bc4c9b9877ba02abf3a501027582958c039c..e8f1bc5ba55cab783844436c698d316c28cb2101 100644 (file)
@@ -913,7 +913,7 @@ static int cli_io_handler_dump_crtlist(struct appctx *appctx)
 {
        struct show_crtlist_ctx *ctx = appctx->svcctx;
        struct buffer *trash = alloc_trash_chunk();
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct ebmb_node *lnode;
 
        if (trash == NULL)
@@ -945,7 +945,7 @@ static int cli_io_handler_dump_crtlist_entries(struct appctx *appctx)
        struct show_crtlist_ctx *ctx = appctx->svcctx;
        struct buffer *trash = alloc_trash_chunk();
        struct crtlist *crtlist;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct crtlist_entry *entry;
 
        if (trash == NULL)
@@ -1071,7 +1071,7 @@ static int cli_io_handler_add_crtlist(struct appctx *appctx)
 {
        struct add_crtlist_ctx *ctx = appctx->svcctx;
        struct bind_conf_list *bind_conf_node;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct crtlist *crtlist = ctx->crtlist;
        struct crtlist_entry *entry = ctx->entry;
        struct ckch_store *store = entry->node.key;
index e8e0eab0a661c5c71d39e5c79e7c1b9113c2bf32..6ffdf4d94637efef84ee00de29be5d7110f5c7a8 100644 (file)
@@ -7224,7 +7224,7 @@ struct tls_keys_ref *tlskeys_ref_lookup_ref(const char *reference)
 static int cli_io_handler_tlskeys_files(struct appctx *appctx)
 {
        struct show_keys_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
 
        switch (ctx->state) {
        case SHOW_KEYS_INIT:
@@ -7503,7 +7503,7 @@ static int cli_io_handler_show_ocspresponse(struct appctx *appctx)
        struct buffer *trash = alloc_trash_chunk();
        struct buffer *tmp = NULL;
        struct ebmb_node *node;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct certificate_ocsp *ocsp = NULL;
        BIO *bio = NULL;
        int write = -1;
@@ -7639,7 +7639,7 @@ static void ssl_provider_clear_name_list(struct list *provider_names)
 static int cli_io_handler_show_providers(struct appctx *appctx)
 {
        struct buffer *trash = get_trash_chunk();
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct list provider_names;
        struct provider_name *name;
 
@@ -7770,7 +7770,7 @@ static int cli_io_handler_show_ocspresponse_detail(struct appctx *appctx)
 {
        struct buffer *trash = alloc_trash_chunk();
        struct certificate_ocsp *ocsp = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
 
        if (trash == NULL)
                return 1;
index aef9bac58977658b6703a389c6eb355eaefb637e..49d6ef0ed1de0f2380e31afaca3eb6077f461c67 100644 (file)
@@ -4283,7 +4283,7 @@ full:
 static void http_stats_io_handler(struct appctx *appctx)
 {
        struct show_stat_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct stream *s = __cs_strm(cs);
        struct channel *req = cs_oc(cs);
        struct channel *res = cs_ic(cs);
@@ -4948,7 +4948,7 @@ static int cli_parse_show_stat(char **args, char *payload, struct appctx *appctx
        ctx->scope_len = 0;
        ctx->flags = STAT_SHNODE | STAT_SHDESC;
 
-       if ((strm_li(__cs_strm(appctx->owner))->bind_conf->level & ACCESS_LVL_MASK) >= ACCESS_LVL_OPER)
+       if ((strm_li(appctx_strm(appctx))->bind_conf->level & ACCESS_LVL_MASK) >= ACCESS_LVL_OPER)
                ctx->flags |= STAT_SHLGNDS;
 
        /* proxy is the default domain */
@@ -5004,7 +5004,7 @@ static int cli_parse_show_stat(char **args, char *payload, struct appctx *appctx
 
 static int cli_io_handler_dump_info(struct appctx *appctx)
 {
-       return stats_dump_info_to_buffer(appctx->owner);
+       return stats_dump_info_to_buffer(appctx_cs(appctx));
 }
 
 /* This I/O handler runs as an applet embedded in a conn-stream. It is
@@ -5012,12 +5012,12 @@ static int cli_io_handler_dump_info(struct appctx *appctx)
  */
 static int cli_io_handler_dump_stat(struct appctx *appctx)
 {
-       return stats_dump_stat_to_buffer(appctx->owner, NULL, NULL);
+       return stats_dump_stat_to_buffer(appctx_cs(appctx), NULL, NULL);
 }
 
 static int cli_io_handler_dump_json_schema(struct appctx *appctx)
 {
-       return stats_dump_json_schema_to_buffer(appctx->owner);
+       return stats_dump_json_schema_to_buffer(appctx_cs(appctx));
 }
 
 int stats_allocate_proxy_counters_internal(struct extra_counters **counters,
index 0e08d7d3b7097e91b1c46de879083f895bc176b3..927772274e45279d7420477ad44a99e5e9494d39 100644 (file)
@@ -4408,7 +4408,7 @@ struct show_table_ctx {
  */
 static int table_process_entry_per_key(struct appctx *appctx, char **args)
 {
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct show_table_ctx *ctx = appctx->svcctx;
        struct stktable *t = ctx->target;
        struct stksess *ts;
@@ -4668,7 +4668,7 @@ err_args:
 static int cli_io_handler_table(struct appctx *appctx)
 {
        struct show_table_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct stream *s = __cs_strm(cs);
        struct ebmb_node *eb;
        int skip_entry;
index d86dbf315665084c016f224e9d558c01a41a363c..c7002366ff9903c14f1e26827d84a458fdab6074 100644 (file)
@@ -2818,7 +2818,7 @@ void stream_dump_and_crash(enum obj_type *obj, int rate)
                if (!appctx)
                        return;
                ptr = appctx;
-               s = __cs_strm(appctx->owner);
+               s = appctx_strm(appctx);
                if (!s)
                        return;
        }
@@ -3524,7 +3524,7 @@ static int cli_parse_show_sess(char **args, char *payload, struct appctx *appctx
        /* let's set our own stream's epoch to the current one and increment
         * it so that we know which streams were already there before us.
         */
-       __cs_strm(appctx->owner)->stream_epoch = _HA_ATOMIC_FETCH_ADD(&stream_epoch, 1);
+       appctx_strm(appctx)->stream_epoch = _HA_ATOMIC_FETCH_ADD(&stream_epoch, 1);
        return 0;
 }
 
@@ -3536,7 +3536,7 @@ static int cli_parse_show_sess(char **args, char *payload, struct appctx *appctx
 static int cli_io_handler_dump_sess(struct appctx *appctx)
 {
        struct show_sess_ctx *ctx = appctx->svcctx;
-       struct conn_stream *cs = appctx->owner;
+       struct conn_stream *cs = appctx_cs(appctx);
        struct connection *conn;
 
        thread_isolate();
@@ -3579,7 +3579,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx)
                else {
                        /* check if we've found a stream created after issuing the "show sess" */
                        curr_strm = LIST_ELEM(ctx->bref.ref, struct stream *, list);
-                       if ((int)(curr_strm->stream_epoch - __cs_strm(appctx->owner)->stream_epoch) > 0)
+                       if ((int)(curr_strm->stream_epoch - appctx_strm(appctx)->stream_epoch) > 0)
                                done = 1;
                }