mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
CLEANUP: applet: remove the unneeded appctx->owner
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.
This commit is contained in:
parent
c1b8d77805
commit
0698c80a58
@ -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);
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
10
src/cache.c
10
src/cache.c
@ -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;
|
||||
|
16
src/cli.c
16
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;
|
||||
|
@ -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);
|
||||
|
10
src/debug.c
10
src/debug.c
@ -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;
|
||||
|
||||
|
@ -438,7 +438,7 @@ int dns_dgram_init(struct dns_nameserver *ns, struct sockaddr_storage *sk)
|
||||
*/
|
||||
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;
|
||||
|
@ -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)
|
||||
|
52
src/hlua.c
52
src/hlua.c
@ -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. */
|
||||
|
@ -195,7 +195,7 @@ static int hc_cli_parse(char **args, char *payload, struct appctx *appctx, void
|
||||
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 @@ struct httpclient *httpclient_new(void *caller, enum http_meth_t meth, struct is
|
||||
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;
|
||||
|
@ -3559,7 +3559,7 @@ void syslog_fd_handler(int fd)
|
||||
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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
26
src/peers.c
26
src/peers.c
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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)))
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 @@ static void sink_forward_io_handler(struct appctx *appctx)
|
||||
*/
|
||||
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 @@ static void sink_forward_oc_io_handler(struct appctx *appctx)
|
||||
|
||||
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;
|
||||
|
@ -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 @@ static int show_crl_detail(X509_CRL *crl, struct buffer *out)
|
||||
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)
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
10
src/stats.c
10
src/stats.c
@ -4283,7 +4283,7 @@ static int stats_send_http_redirect(struct conn_stream *cs, struct htx *htx)
|
||||
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,
|
||||
|
@ -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 @@ static int cli_parse_table_req(char **args, char *payload, struct appctx *appctx
|
||||
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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user