]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: applet: use applet_put*() everywhere possible
authorWilly Tarreau <w@1wt.eu>
Wed, 18 May 2022 13:07:19 +0000 (15:07 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 May 2022 17:33:34 +0000 (19:33 +0200)
This applies the change so that the applet code stops using ci_putchk()
and friends everywhere possible, for the much saferapplet_put*() instead.
The change is mechanical but large. Two or three functions used to have no
appctx and a cs derived from the appctx instead, which was a reminiscence
of old times' stream_interface. These were simply changed to directly take
the appctx. No sensitive change was performed, and the old (more complex)
API is still usable when needed (e.g. the channel is already known).

The change touched roughly a hundred of locations, with no less than 124
lines removed.

It's worth noting that the stats applet, the oldest of the series, could
get a serious lifting, as it's still very channel-centric instead of
propagating the appctx along the chain. Given that this code doesn't
change often, there's no emergency to clean it up but it would look
better.

22 files changed:
src/activity.c
src/cache.c
src/cli.c
src/debug.c
src/dns.c
src/flt_spoe.c
src/http_client.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 a84925de59b6648492edbb093dddda06b3d4e073..1b938a23c03cef4dbcb566991a779348820ea8cb 100644 (file)
@@ -647,9 +647,8 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
                     "Memory usage profiling              : %-8s      # set profiling memory {on|off}\n",
                     str, (profiling & HA_PROF_MEMORY) ? "on" : "off");
 
-       if (ci_putchk(cs_ic(cs), &trash) == -1) {
+       if (applet_putchk(appctx, &trash) == -1) {
                /* failed, try again */
-               cs_rx_room_blk(cs);
                return 0;
        }
 
@@ -697,16 +696,14 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
                print_time_short(&trash, "   ", tmp_activity[i].lat_time, "");
                print_time_short(&trash, "   ", tmp_activity[i].lat_time / tmp_activity[i].calls, "\n");
 
-               if (ci_putchk(cs_ic(cs), &trash) == -1) {
+               if (applet_putchk(appctx, &trash) == -1) {
                        /* failed, try again */
-                       cs_rx_room_blk(cs);
                        return 0;
                }
        }
 
-       if (ci_putchk(cs_ic(cs), &trash) == -1) {
+       if (applet_putchk(appctx, &trash) == -1) {
                /* failed, try again */
-               cs_rx_room_blk(cs);
                return 0;
        }
 
@@ -762,16 +759,12 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
 
                chunk_appendf(&trash, "\n");
 
-               if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, &trash) == -1)
                        return 0;
-               }
        }
 
-       if (ci_putchk(cs_ic(cs), &trash) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putchk(appctx, &trash) == -1)
                return 0;
-       }
 
        tot_alloc_calls = tot_free_calls = tot_alloc_bytes = tot_free_bytes = 0;
        for (i = 0; i < max_lines; i++) {
@@ -789,10 +782,8 @@ static int cli_io_handler_show_profiling(struct appctx *appctx)
                      tot_alloc_calls - tot_free_calls,
                      tot_alloc_bytes - tot_free_bytes);
 
-       if (ci_putchk(cs_ic(cs), &trash) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putchk(appctx, &trash) == -1)
                return 0;
-       }
 
        ctx->linenum = 0; // reset first line to dump
        if ((ctx->dump_step & 4) == 0)
@@ -976,9 +967,8 @@ static int cli_io_handler_show_tasks(struct appctx *appctx)
                print_time_short(&trash, "   ", tmp_activity[i].lat_time / tmp_activity[i].calls, "\n");
        }
 
-       if (ci_putchk(cs_ic(cs), &trash) == -1) {
+       if (applet_putchk(appctx, &trash) == -1) {
                /* failed, try again */
-               cs_rx_room_blk(cs);
                return 0;
        }
        return 1;
index 8a79ef05c5e669c94370e7fa20a23441ee811580..f28ff89527931eaaca6cb66246028d4e243e6ed2 100644 (file)
@@ -2600,7 +2600,6 @@ static int cli_io_handler_show_cache(struct appctx *appctx)
 {
        struct show_cache_ctx *ctx = appctx->svcctx;
        struct cache* cache = ctx->cache;
-       struct stconn *cs = appctx_cs(appctx);
 
        list_for_each_entry_from(cache, &caches, list) {
                struct eb32_node *node = NULL;
@@ -2611,10 +2610,8 @@ static int cli_io_handler_show_cache(struct appctx *appctx)
                next_key = ctx->next_key;
                if (!next_key) {
                        chunk_printf(&trash, "%p: %s (shctx:%p, available blocks:%d)\n", cache, cache->id, shctx_ptr(cache), shctx_ptr(cache)->nbav);
-                       if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                               cs_rx_room_blk(cs);
+                       if (applet_putchk(appctx, &trash) == -1)
                                return 0;
-                       }
                }
 
                ctx->cache = cache;
@@ -2649,10 +2646,8 @@ static int cli_io_handler_show_cache(struct appctx *appctx)
 
                        shctx_unlock(shctx_ptr(cache));
 
-                       if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                               cs_rx_room_blk(cs);
+                       if (applet_putchk(appctx, &trash) == -1)
                                return 0;
-                       }
                }
 
        }
index 273fe8684905895bb90b1415cab62a2d60ad0c66..95d487d50e96c606dc47fea10d2de89fb0fa7e57 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -1131,10 +1131,8 @@ static void cli_io_handler(struct appctx *appctx)
                                                prompt = "\n";
                                }
 
-                               if (ci_putstr(cs_ic(cs), prompt) != -1)
+                               if (applet_putstr(appctx, prompt) != -1)
                                        appctx->st0 = CLI_ST_GETREQ;
-                               else
-                                       cs_rx_room_blk(cs);
                        }
 
                        /* If the output functions are still there, it means they require more room. */
@@ -1240,10 +1238,9 @@ static int cli_io_handler_show_env(struct appctx *appctx)
        while (*var) {
                chunk_printf(&trash, "%s\n", *var);
 
-               if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, &trash) == -1)
                        return 0;
-               }
+
                if (ctx->show_one)
                        break;
                var++;
@@ -1434,8 +1431,7 @@ static int cli_io_handler_show_fd(struct appctx *appctx)
 #endif
                chunk_appendf(&trash, "%s\n", suspicious ? " !" : "");
 
-               if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, &trash) == -1) {
                        fdctx->fd = fd;
                        ret = 0;
                        break;
@@ -1546,10 +1542,9 @@ static int cli_io_handler_show_activity(struct appctx *appctx)
        chunk_appendf(&trash, "ctr2:");         SHOW_TOT(thr, activity[thr].ctr2);
 #endif
 
-       if (ci_putchk(cs_ic(cs), &trash) == -1) {
+       if (applet_putchk(appctx, &trash) == -1) {
                chunk_reset(&trash);
                chunk_printf(&trash, "[output too large, cannot dump]\n");
-               cs_rx_room_blk(cs);
        }
 
 #undef SHOW_AVG
@@ -1567,7 +1562,6 @@ 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 stconn *cs = appctx_cs(appctx);
 
        if (!global.cli_fe)
                goto done;
@@ -1576,7 +1570,7 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx)
 
        if (!bind_conf) {
                /* first call */
-               if (ci_putstr(cs_ic(cs), "# socket lvl processes\n") == -1)
+               if (applet_putstr(appctx, "# socket lvl processes\n") == -1)
                        goto full;
                bind_conf = LIST_ELEM(global.cli_fe->conf.bind.n, typeof(bind_conf), by_fe);
        }
@@ -1624,7 +1618,7 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx)
 
                        chunk_appendf(&trash, "all\n");
 
-                       if (ci_putchk(cs_ic(cs), &trash) == -1) {
+                       if (applet_putchk(appctx, &trash) == -1) {
                                ctx->bind_conf = bind_conf;
                                ctx->listener  = l;
                                goto full;
@@ -1634,7 +1628,6 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx)
  done:
        return 1;
  full:
-       cs_rx_room_blk(cs);
        return 0;
 }
 
index 1f96d6aa9bd88e21330578e81f1c053cc2e91baf..71f6762f083812c3ea2897ec270dfd0e3bcd8795 100644 (file)
@@ -304,9 +304,8 @@ static int cli_io_handler_show_threads(struct appctx *appctx)
        chunk_reset(&trash);
        ha_thread_dump_all_to_trash();
 
-       if (ci_putchk(cs_ic(cs), &trash) == -1) {
+       if (applet_putchk(appctx, &trash) == -1) {
                /* failed, try again */
-               cs_rx_room_blk(cs);
                appctx->st1 = thr;
                return 0;
        }
@@ -1177,8 +1176,7 @@ static int debug_iohandler_fd(struct appctx *appctx)
 
                chunk_appendf(&trash, "\n");
 
-               if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, &trash) == -1) {
                        ctx->start_fd = fd;
                        ret = 0;
                        break;
@@ -1288,8 +1286,7 @@ static int debug_iohandler_memstats(struct appctx *appctx)
                             (unsigned long)ptr->size, (unsigned long)ptr->calls,
                             (unsigned long)(ptr->calls ? (ptr->size / ptr->calls) : 0));
 
-               if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, &trash) == -1) {
                        ctx->start = ptr;
                        ret = 0;
                        break;
index 713008eb73a15705943881da2292cd9ca6bf5456..3ed68922c896bac8a1038b16f8c70afae4ab245f 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -544,7 +544,7 @@ static void dns_session_io_handler(struct appctx *appctx)
                                /* put msg len into then channel */
                                slen = (uint16_t)msg_len;
                                slen = htons(slen);
-                               ci_putblk(cs_ic(cs), (char *)&slen, sizeof(slen));
+                               applet_putblk(appctx, (char *)&slen, sizeof(slen));
                                available_room -= sizeof(slen);
 
                                /* backup original query id */
@@ -562,7 +562,7 @@ static void dns_session_io_handler(struct appctx *appctx)
                                new_qid = htons(new_qid);
 
                                /* put new query id into the channel */
-                               ci_putblk(cs_ic(cs), (char *)&new_qid, sizeof(new_qid));
+                               applet_putblk(appctx, (char *)&new_qid, sizeof(new_qid));
                                available_room -= sizeof(new_qid);
 
                                /* keep query id mapping */
@@ -617,12 +617,11 @@ static void dns_session_io_handler(struct appctx *appctx)
                        }
                        trash.data += len;
 
-                       if (ci_putchk(cs_ic(cs), &trash) == -1) {
+                       if (applet_putchk(appctx, &trash) == -1) {
                                /* should never happen since we
                                 * check available_room is large
                                 * enough here.
                                 */
-                               cs_rx_room_blk(cs);
                                ret = 0;
                                break;
                        }
index c745e19222d51c0320a1b5e98389934c9d97c33b..df416e7546c4c9e06359462693b55804adda07d0 100644 (file)
@@ -1145,9 +1145,10 @@ spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz)
         * length. */
        netint = htonl(framesz);
        memcpy(buf, (char *)&netint, 4);
-       ret = ci_putblk(cs_ic(cs), buf, framesz+4);
+       ret = applet_putblk(appctx, buf, framesz+4);
        if (ret <= 0) {
                if ((ret == -3 && b_is_null(&cs_ic(cs)->buf)) || ret == -1) {
+                       /* WT: is this still needed for the case ret==-3 ? */
                        cs_rx_room_blk(cs);
                        return 1; /* retry */
                }
index 14140442a53c1b18d37c0b84f78056d6355d91ad..3b76e36ad50da8c2feefbdc46b3f3896ac990f37 100644 (file)
@@ -206,8 +206,7 @@ static int hc_cli_io_handler(struct appctx *appctx)
        if (ctx->flags & HC_CLI_F_RES_STLINE) {
                chunk_appendf(trash, "%.*s %d %.*s\n", (unsigned int)istlen(hc->res.vsn), istptr(hc->res.vsn),
                              hc->res.status, (unsigned int)istlen(hc->res.reason), istptr(hc->res.reason));
-               if (ci_putchk(cs_ic(cs), trash) == -1)
-                       cs_rx_room_blk(cs);
+               applet_putchk(appctx, trash);
                ctx->flags &= ~HC_CLI_F_RES_STLINE;
                goto out;
        }
@@ -220,8 +219,7 @@ static int hc_cli_io_handler(struct appctx *appctx)
                }
                if (!chunk_memcat(trash, "\r\n", 2))
                        goto out;
-               if (ci_putchk(cs_ic(cs), trash) == -1)
-                       cs_rx_room_blk(cs);
+               applet_putchk(appctx, trash);
                ctx->flags &= ~HC_CLI_F_RES_HDR;
                goto out;
        }
index eae597d47deb508cb680521aad2de1472eb6b5ff..00185cee7b71a5ef256f2d76482a1093a48b5a12 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -392,13 +392,12 @@ static int cli_io_handler_pat_list(struct appctx *appctx)
                                chunk_appendf(&trash, "%p %s\n",
                                              elt, elt->pattern);
 
-                       if (ci_putchk(cs_ic(cs), &trash) == -1) {
+                       if (applet_putchk(appctx, &trash) == -1) {
                                /* let's try again later from this stream. We add ourselves into
                                 * this stream's users so that it can remove us upon termination.
                                 */
                                LIST_APPEND(&elt->back_refs, &ctx->bref.users);
                                HA_SPIN_UNLOCK(PATREF_LOCK, &ctx->ref->lock);
-                               cs_rx_room_blk(cs);
                                return 0;
                        }
                skip:
@@ -417,7 +416,6 @@ 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 stconn *cs = appctx_cs(appctx);
 
        switch (ctx->state) {
        case STATE_INIT:
@@ -427,10 +425,8 @@ static int cli_io_handler_pats_list(struct appctx *appctx)
                 */
                chunk_reset(&trash);
                chunk_appendf(&trash, "# id (file) description\n");
-               if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, &trash) == -1)
                        return 0;
-               }
 
                /* Now, we start the browsing of the references lists.
                 * Note that the following call to LIST_ELEM returns a bad pointer. The only
@@ -455,11 +451,10 @@ static int cli_io_handler_pats_list(struct appctx *appctx)
                                      ctx->ref->display, ctx->ref->curr_gen, ctx->ref->next_gen,
                                      ctx->ref->entry_cnt);
 
-                       if (ci_putchk(cs_ic(cs), &trash) == -1) {
+                       if (applet_putchk(appctx, &trash) == -1) {
                                /* let's try again later from this stream. We add ourselves into
                                 * this stream's users so that it can remove us upon termination.
                                 */
-                               cs_rx_room_blk(cs);
                                return 0;
                        }
 
@@ -480,7 +475,6 @@ 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 stconn *cs = appctx_cs(appctx);
        struct sample sample;
        struct pattern *pat;
        int match_method;
@@ -576,12 +570,11 @@ static int cli_io_handler_map_lookup(struct appctx *appctx)
                        chunk_appendf(&trash, "\n");
 
                        /* display response */
-                       if (ci_putchk(cs_ic(cs), &trash) == -1) {
+                       if (applet_putchk(appctx, &trash) == -1) {
                                /* let's try again later from this stream. We add ourselves into
                                 * this stream's users so that it can remove us upon termination.
                                 */
                                HA_SPIN_UNLOCK(PATREF_LOCK, &ctx->ref->lock);
-                               cs_rx_room_blk(cs);
                                return 0;
                        }
 
index 698321e083f124635c7e3034e2e4482b1e7ab1c0..7f0f711e5969d61c7130e9912f513d935e676dce 100644 (file)
@@ -603,10 +603,8 @@ static int cli_io_handler_show_proc(struct appctx *appctx)
 
 
 
-       if (ci_putchk(cs_ic(cs), &trash) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putchk(appctx, &trash) == -1)
                return 0;
-       }
 
        /* dump complete */
        return 1;
index 0a7a9268cb52f6a146a5bd73f3f14925568b60c0..c93faf33effc965f71ee19a2c28c4aa84737e652 100644 (file)
@@ -3744,7 +3744,7 @@ static int cli_parse_show_peers(char **args, char *payload, struct appctx *appct
  * Returns 0 if the output buffer is full and needs to be called again, non-zero if not.
  * Dedicated to be called by cli_io_handler_show_peers() cli I/O handler.
  */
-static int peers_dump_head(struct buffer *msg, struct stconn *cs, struct peers *peers)
+static int peers_dump_head(struct buffer *msg, struct appctx *appctx, struct peers *peers)
 {
        struct tm tm;
 
@@ -3760,10 +3760,8 @@ static int peers_dump_head(struct buffer *msg, struct stconn *cs, struct peers *
                                             TICKS_TO_MS(1000)) : "<NEVER>",
                      peers->sync_task ? peers->sync_task->calls : 0);
 
-       if (ci_putchk(cs_ic(cs), msg) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putchk(appctx, msg) == -1)
                return 0;
-       }
 
        return 1;
 }
@@ -3919,10 +3917,8 @@ static int peers_dump_peer(struct buffer *msg, struct stconn *cs, struct peer *p
 
  end:
        chunk_appendf(&trash, "\n");
-       if (ci_putchk(cs_ic(cs), msg) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putchk(appctx, msg) == -1)
                return 0;
-       }
 
        return 1;
 }
@@ -3954,7 +3950,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_cs(appctx), ctx->peers))
+                               if (!peers_dump_head(&trash, appctx, ctx->peers))
                                        goto out;
 
                                ctx->peer = ctx->peers->remote;
index 4cc098d608f9dfabac2169a0c50d1a78a9e874fa..a47168fb609fc4b7a85d3fc96158eaea808f434f 100644 (file)
@@ -1011,13 +1011,9 @@ int pool_parse_debugging(const char *str, char **err)
  */
 static int cli_io_handler_dump_pools(struct appctx *appctx)
 {
-       struct stconn *cs = appctx_cs(appctx);
-
        dump_pools_to_trash();
-       if (ci_putchk(cs_ic(cs), &trash) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putchk(appctx, &trash) == -1)
                return 0;
-       }
        return 1;
 }
 
index f73760f698345df43d2628a96b93e627b0cf7430..92fc73014194f7d39a2780edacf3a5b8dac95476 100644 (file)
@@ -2772,8 +2772,7 @@ static int dump_servers_state(struct stconn *cs)
                        chunk_appendf(&trash, "\n");
                }
 
-               if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, &trash) == -1) {
                        return 0;
                }
        }
@@ -2798,10 +2797,9 @@ static int cli_io_handler_servers_state(struct appctx *appctx)
                                     "# bkname/svname bkid/svid addr port - purge_delay used_cur used_max need_est unsafe_nb safe_nb idle_lim idle_cur idle_per_thr[%d]\n",
                                     global.nbthread);
 
-               if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, &trash) == -1)
                        return 0;
-               }
+
                ctx->state = SHOW_SRV_LIST;
 
                if (!ctx->px)
@@ -2828,17 +2826,15 @@ static int cli_io_handler_servers_state(struct appctx *appctx)
  */
 static int cli_io_handler_show_backend(struct appctx *appctx)
 {
-       struct stconn *cs = appctx_cs(appctx);
        struct proxy *curproxy;
 
        chunk_reset(&trash);
 
        if (!appctx->svcctx) {
                chunk_printf(&trash, "# name\n");
-               if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, &trash) == -1)
                        return 0;
-               }
+
                appctx->svcctx = proxies_list;
        }
 
@@ -2850,10 +2846,8 @@ static int cli_io_handler_show_backend(struct appctx *appctx)
                        continue;
 
                chunk_appendf(&trash, "%s\n", curproxy->id);
-               if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, &trash) == -1)
                        return 0;
-               }
        }
 
        return 1;
@@ -3164,7 +3158,7 @@ static int cli_io_handler_show_errors(struct appctx *appctx)
                             tm.tm_hour, tm.tm_min, tm.tm_sec, (int)(date.tv_usec/1000),
                             error_snapshot_id);
 
-               if (ci_putchk(cs_ic(cs), &trash) == -1)
+               if (applet_putchk(appctx, &trash) == -1)
                        goto cant_send;
 
                ctx->px = proxies_list;
@@ -3254,7 +3248,7 @@ static int cli_io_handler_show_errors(struct appctx *appctx)
 
                        chunk_appendf(&trash, "  \n");
 
-                       if (ci_putchk(cs_ic(cs), &trash) == -1)
+                       if (applet_putchk(appctx, &trash) == -1)
                                goto cant_send_unlock;
 
                        ctx->ptr = 0;
@@ -3265,7 +3259,7 @@ static int cli_io_handler_show_errors(struct appctx *appctx)
                        /* the snapshot changed while we were dumping it */
                        chunk_appendf(&trash,
                                     "  WARNING! update detected on this snapshot, dump interrupted. Please re-check!\n");
-                       if (ci_putchk(cs_ic(cs), &trash) == -1)
+                       if (applet_putchk(appctx, &trash) == -1)
                                goto cant_send_unlock;
 
                        goto next;
@@ -3281,7 +3275,7 @@ static int cli_io_handler_show_errors(struct appctx *appctx)
                        if (newptr == ctx->ptr)
                                goto cant_send_unlock;
 
-                       if (ci_putchk(cs_ic(cs), &trash) == -1)
+                       if (applet_putchk(appctx, &trash) == -1)
                                goto cant_send_unlock;
 
                        ctx->ptr = newptr;
index 1110ef5e2de1623203c88d0831e0d4d5daf4091b..9add40babf83a9aefe4733c6bf32959c1856e422 100644 (file)
@@ -2757,14 +2757,13 @@ 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 stconn *cs = appctx_cs(appctx);
        struct resolvers    *resolvers = ctx->resolvers;
        struct dns_nameserver   *ns;
 
        chunk_reset(&trash);
 
        if (LIST_ISEMPTY(&sec_resolvers)) {
-               if (ci_putstr(cs_ic(cs), "No resolvers found\n") == -1)
+               if (applet_putstr(appctx, "No resolvers found\n") == -1)
                        goto full;
        }
        else {
@@ -2780,7 +2779,7 @@ static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx)
 
                        if (!ns) {
                                chunk_printf(&trash, "Resolvers section %s\n", resolvers->id);
-                               if (ci_putchk(cs_ic(cs), &trash) == -1)
+                               if (applet_putchk(appctx, &trash) == -1)
                                        goto full;
 
                                ns = LIST_ELEM(resolvers->nameservers.n, typeof(ns), list);
@@ -2805,7 +2804,7 @@ static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx)
                                chunk_appendf(&trash, "  too_big:     %lld\n", ns->counters->app.resolver.too_big);
                                chunk_appendf(&trash, "  truncated:   %lld\n", ns->counters->app.resolver.truncated);
                                chunk_appendf(&trash, "  outdated:    %lld\n",  ns->counters->app.resolver.outdated);
-                               if (ci_putchk(cs_ic(cs), &trash) == -1)
+                               if (applet_putchk(appctx, &trash) == -1)
                                        goto full;
                                ctx->ns = ns;
                        }
@@ -2822,7 +2821,6 @@ static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx)
        return 1;
  full:
        /* the output buffer is full, retry later */
-       cs_rx_room_blk(cs);
        return 0;
 }
 
index b712b5ee8af642f9186ae7910d8b342c9116b985..a389f5b2448b8294ec42454c9e4ac2cf15ca97f5 100644 (file)
@@ -357,8 +357,7 @@ int cli_io_handler_show_ring(struct appctx *appctx)
                trash.data += len;
                trash.area[trash.data++] = '\n';
 
-               if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, &trash) == -1) {
                        ret = 0;
                        break;
                }
index 9ef8d0dec663cdf76df332aa672664490a7c0180..6057b4fdec59435430a23e0a2c3a57879961e29f 100644 (file)
@@ -4315,7 +4315,6 @@ 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 stconn *cs = appctx_cs(appctx);
        struct proxy *px;
        struct server *sv;
        char *line;
@@ -4337,10 +4336,8 @@ static int cli_parse_get_weight(char **args, char *payload, struct appctx *appct
        /* return server's effective weight at the moment */
        snprintf(trash.area, trash.size, "%d (initial %d)\n", sv->uweight,
                 sv->iweight);
-       if (ci_putstr(cs_ic(cs), trash.area) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putstr(appctx, trash.area) == -1)
                return 0;
-       }
        return 1;
 }
 
index 2ff2a66bcca0330610517b9b82c5f4d503bba5b6..94addd4e11c69bf07d75d3b5aed8db2249c31410 100644 (file)
@@ -399,8 +399,7 @@ static void sink_forward_io_handler(struct appctx *appctx)
                        trash.data += len;
                        trash.area[trash.data++] = '\n';
 
-                       if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                               cs_rx_room_blk(cs);
+                       if (applet_putchk(appctx, &trash) == -1) {
                                ret = 0;
                                break;
                        }
@@ -544,8 +543,7 @@ static void sink_forward_oc_io_handler(struct appctx *appctx)
 
                        trash.data += b_getblk(buf, p + 1, msg_len, ofs + cnt);
 
-                       if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                               cs_rx_room_blk(cs);
+                       if (applet_putchk(appctx, &trash) == -1) {
                                ret = 0;
                                break;
                        }
index b00cc51cef2cd26d28e7cdfab83a291af6b38ad4..505353c6fa65482138fd8fc9ae305140a77a74e2 100644 (file)
@@ -1319,7 +1319,6 @@ 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 stconn *cs = appctx_cs(appctx);
        struct ckch_store *ckchs;
 
        if (trash == NULL)
@@ -1344,10 +1343,8 @@ static int cli_io_handler_show_cert(struct appctx *appctx)
                chunk_appendf(trash, "%s\n", ckchs->path);
 
                node = ebmb_next(node);
-               if (ci_putchk(cs_ic(cs), trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, trash) == -1)
                        goto yield;
-               }
        }
 
        ctx->cur_ckchs = NULL;
@@ -1721,7 +1718,6 @@ 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 stconn *cs = appctx_cs(appctx);
        struct ckch_store *ckchs = ctx->cur_ckchs;
        struct buffer *out = alloc_trash_chunk();
        int retval = 0;
@@ -1751,10 +1747,8 @@ static int cli_io_handler_show_cert_detail(struct appctx *appctx)
        ckch_store_show_ocsp_certid(ckchs, out);
 
 end:
-       if (ci_putchk(cs_ic(cs), out) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putchk(appctx, out) == -1)
                goto yield;
-       }
 
 end_no_putchk:
        free_trash_chunk(out);
@@ -1772,7 +1766,6 @@ 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 stconn *cs = appctx_cs(appctx);
        struct ckch_store *ckchs = ctx->cur_ckchs;
        struct buffer *out = alloc_trash_chunk();
        int from_transaction = ctx->transaction;
@@ -1799,10 +1792,8 @@ static int cli_io_handler_show_cert_ocsp_detail(struct appctx *appctx)
                        goto end_no_putchk;
        }
 
-       if (ci_putchk(cs_ic(cs), out) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putchk(appctx, out) == -1)
                goto yield;
-       }
 
 end_no_putchk:
        free_trash_chunk(out);
@@ -2071,10 +2062,9 @@ static int cli_io_handler_commit_cert(struct appctx *appctx)
                        case CERT_ST_INIT:
                                /* This state just print the update message */
                                chunk_printf(trash, "Committing %s", ckchs_transaction.path);
-                               if (ci_putchk(cs_ic(cs), trash) == -1) {
-                                       cs_rx_room_blk(cs);
+                               if (applet_putchk(appctx, trash) == -1)
                                        goto yield;
-                               }
+
                                ctx->state = CERT_ST_GEN;
                                /* fallthrough */
                        case CERT_ST_GEN:
@@ -2146,15 +2136,13 @@ end:
 
        chunk_appendf(trash, "\n");
        chunk_appendf(trash, "Success!\n");
-       if (ci_putchk(cs_ic(cs), trash) == -1)
-               cs_rx_room_blk(cs);
+       applet_putchk(appctx, trash);
        free_trash_chunk(trash);
        /* success: call the release function and don't come back */
        return 1;
 yield:
        /* store the state */
-       if (ci_putchk(cs_ic(cs), trash) == -1)
-               cs_rx_room_blk(cs);
+       applet_putchk(appctx, trash);
        free_trash_chunk(trash);
        cs_rx_endp_more(cs); /* let's come back later */
        return 0; /* should come back */
@@ -2163,8 +2151,7 @@ error:
        /* spin unlock and free are done in the release  function */
        if (trash) {
                chunk_appendf(trash, "\n%sFailed!\n", err);
-               if (ci_putchk(cs_ic(cs), trash) == -1)
-                       cs_rx_room_blk(cs);
+               applet_putchk(appctx, trash);
                free_trash_chunk(trash);
        }
        /* error: call the release function and don't come back */
@@ -2825,10 +2812,9 @@ static int cli_io_handler_commit_cafile_crlfile(struct appctx *appctx)
                                default:
                                        goto error;
                                }
-                               if (ci_putchk(cs_ic(cs), trash) == -1) {
-                                       cs_rx_room_blk(cs);
+                               if (applet_putchk(appctx, trash) == -1)
                                        goto yield;
-                               }
+
                                ctx->state = CACRL_ST_GEN;
                                /* fallthrough */
                        case CACRL_ST_GEN:
@@ -2936,15 +2922,13 @@ end:
 
        chunk_appendf(trash, "\n");
        chunk_appendf(trash, "Success!\n");
-       if (ci_putchk(cs_ic(cs), trash) == -1)
-               cs_rx_room_blk(cs);
+       applet_putchk(appctx, trash);
        free_trash_chunk(trash);
        /* success: call the release function and don't come back */
        return 1;
 yield:
        /* store the state */
-       if (ci_putchk(cs_ic(cs), trash) == -1)
-               cs_rx_room_blk(cs);
+       applet_putchk(appctx, trash);
        free_trash_chunk(trash);
        cs_rx_endp_more(cs); /* let's come back later */
        return 0; /* should come back */
@@ -2953,8 +2937,7 @@ error:
        /* spin unlock and free are done in the release function */
        if (trash) {
                chunk_appendf(trash, "\n%sFailed!\n", err);
-               if (ci_putchk(cs_ic(cs), trash) == -1)
-                       cs_rx_room_blk(cs);
+               applet_putchk(appctx, trash);
                free_trash_chunk(trash);
        }
        /* error: call the release function and don't come back */
@@ -3030,7 +3013,6 @@ 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 stconn *cs = appctx_cs(appctx);
        struct cafile_entry *cafile_entry = ctx->cur_cafile_entry;
        struct buffer *out = alloc_trash_chunk();
        int i = 0;
@@ -3074,10 +3056,8 @@ static int cli_io_handler_show_cafile_detail(struct appctx *appctx)
                else if (retval)
                        goto yield;
 
-               if (ci_putchk(cs_ic(cs), out) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, out) == -1)
                        goto yield;
-               }
 
                if (!show_all)   /* only need to dump one certificate */
                        goto end;
@@ -3201,7 +3181,6 @@ 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 stconn *cs = appctx_cs(appctx);
        struct cafile_entry *cafile_entry;
 
        if (trash == NULL)
@@ -3234,10 +3213,8 @@ static int cli_io_handler_show_cafile(struct appctx *appctx)
                }
 
                node = ebmb_next(node);
-               if (ci_putchk(cs_ic(cs), trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, trash) == -1)
                        goto yield;
-               }
        }
 
        ctx->cur_cafile_entry = NULL;
@@ -3717,7 +3694,6 @@ end:
 static int cli_io_handler_show_crlfile_detail(struct appctx *appctx)
 {
        struct show_crlfile_ctx *ctx = appctx->svcctx;
-       struct stconn *cs = appctx_cs(appctx);
        struct cafile_entry *cafile_entry = ctx->cafile_entry;
        struct buffer *out = alloc_trash_chunk();
        int i;
@@ -3764,10 +3740,8 @@ static int cli_io_handler_show_crlfile_detail(struct appctx *appctx)
        }
 
 end:
-       if (ci_putchk(cs_ic(cs), out) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putchk(appctx, out) == -1)
                goto yield;
-       }
 
 end_no_putchk:
        free_trash_chunk(out);
@@ -3852,7 +3826,6 @@ 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 stconn *cs = appctx_cs(appctx);
        struct cafile_entry *cafile_entry;
 
        if (trash == NULL)
@@ -3881,10 +3854,8 @@ static int cli_io_handler_show_crlfile(struct appctx *appctx)
                }
 
                node = ebmb_next(node);
-               if (ci_putchk(cs_ic(cs), trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, trash) == -1)
                        goto yield;
-               }
        }
 
        ctx->cafile_entry = NULL;
index 40984358c91991d269dcd56aad1dff7fa5ef5a3c..106648e18ca6f2625e6ff05a4764d14af97b405e 100644 (file)
@@ -913,7 +913,6 @@ static int cli_io_handler_dump_crtlist(struct appctx *appctx)
 {
        struct show_crtlist_ctx *ctx = appctx->svcctx;
        struct buffer *trash = alloc_trash_chunk();
-       struct stconn *cs = appctx_cs(appctx);
        struct ebmb_node *lnode;
 
        if (trash == NULL)
@@ -925,10 +924,8 @@ static int cli_io_handler_dump_crtlist(struct appctx *appctx)
                lnode = ebmb_first(&crtlists_tree);
        while (lnode) {
                chunk_appendf(trash, "%s\n", lnode->key);
-               if (ci_putchk(cs_ic(cs), trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, trash) == -1)
                        goto yield;
-               }
                lnode = ebmb_next(lnode);
        }
        free_trash_chunk(trash);
@@ -945,7 +942,6 @@ 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 stconn *cs = appctx_cs(appctx);
        struct crtlist_entry *entry;
 
        if (trash == NULL)
@@ -957,10 +953,8 @@ static int cli_io_handler_dump_crtlist_entries(struct appctx *appctx)
        if (entry == NULL) {
                entry = LIST_ELEM((crtlist->ord_entries).n, typeof(entry), by_crtlist);
                chunk_appendf(trash, "# %s\n", crtlist->node.key);
-               if (ci_putchk(cs_ic(cs), trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, trash) == -1)
                        goto yield;
-               }
        }
 
        list_for_each_entry_from(entry, &crtlist->ord_entries, by_crtlist) {
@@ -976,10 +970,8 @@ static int cli_io_handler_dump_crtlist_entries(struct appctx *appctx)
                dump_crtlist_filters(trash, entry);
                chunk_appendf(trash, "\n");
 
-               if (ci_putchk(cs_ic(cs), trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, trash) == -1)
                        goto yield;
-               }
        }
        free_trash_chunk(trash);
        return 1;
@@ -1094,10 +1086,8 @@ static int cli_io_handler_add_crtlist(struct appctx *appctx)
        case ADDCRT_ST_INIT:
                /* This state just print the update message */
                chunk_printf(trash, "Inserting certificate '%s' in crt-list '%s'", store->path, crtlist->node.key);
-               if (ci_putchk(cs_ic(cs), trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, trash) == -1)
                        goto yield;
-               }
                ctx->state = ADDCRT_ST_GEN;
                /* fallthrough */
        case ADDCRT_ST_GEN:
@@ -1155,15 +1145,13 @@ static int cli_io_handler_add_crtlist(struct appctx *appctx)
        if (errcode & ERR_WARN)
                chunk_appendf(trash, "%s", err);
        chunk_appendf(trash, "Success!\n");
-       if (ci_putchk(cs_ic(cs), trash) == -1)
-               cs_rx_room_blk(cs);
+       applet_putchk(appctx, trash);
        free_trash_chunk(trash);
        /* success: call the release function and don't come back */
        return 1;
 yield:
        /* store the state */
-       if (ci_putchk(cs_ic(cs), trash) == -1)
-               cs_rx_room_blk(cs);
+       applet_putchk(appctx, trash);
        free_trash_chunk(trash);
        cs_rx_endp_more(cs); /* let's come back later */
        return 0; /* should come back */
@@ -1172,8 +1160,7 @@ error:
        /* spin unlock and free are done in the release function */
        if (trash) {
                chunk_appendf(trash, "\n%sFailed!\n", err);
-               if (ci_putchk(cs_ic(cs), trash) == -1)
-                       cs_rx_room_blk(cs);
+               applet_putchk(appctx, trash);
                free_trash_chunk(trash);
        }
        /* error: call the release function and don't come back */
index 6578e91f4ede5abeb9adca2f7179c2fe4f686557..ee73566ecf4e11164b4b77e70746475fb619d4f7 100644 (file)
@@ -7259,7 +7259,6 @@ 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 stconn *cs = appctx_cs(appctx);
 
        switch (ctx->state) {
        case SHOW_KEYS_INIT:
@@ -7274,10 +7273,8 @@ static int cli_io_handler_tlskeys_files(struct appctx *appctx)
                else
                        chunk_appendf(&trash, "# id (file)\n");
 
-               if (ci_putchk(cs_ic(cs), &trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, &trash) == -1)
                        return 0;
-               }
 
                /* Now, we start the browsing of the references lists.
                 * Note that the following call to LIST_ELEM return bad pointer. The only
@@ -7330,12 +7327,11 @@ static int cli_io_handler_tlskeys_files(struct appctx *appctx)
                                                chunk_appendf(&trash, "%d.%d <unknown>\n", ref->unique_id, ctx->next_index);
                                        }
 
-                                       if (ci_putchk(cs_ic(cs), &trash) == -1) {
+                                       if (applet_putchk(appctx, &trash) == -1) {
                                                /* let's try again later from this stream. We add ourselves into
                                                 * this stream's users so that it can remove us upon termination.
                                                 */
                                                HA_RWLOCK_RDUNLOCK(TLSKEYS_REF_LOCK, &ref->lock);
-                                               cs_rx_room_blk(cs);
                                                return 0;
                                        }
                                        ctx->next_index++;
@@ -7343,11 +7339,10 @@ static int cli_io_handler_tlskeys_files(struct appctx *appctx)
                                HA_RWLOCK_RDUNLOCK(TLSKEYS_REF_LOCK, &ref->lock);
                                ctx->next_index = 0;
                        }
-                       if (ci_putchk(cs_ic(cs), &trash) == -1) {
+                       if (applet_putchk(appctx, &trash) == -1) {
                                /* let's try again later from this stream. We add ourselves into
                                 * this stream's users so that it can remove us upon termination.
                                 */
-                               cs_rx_room_blk(cs);
                                return 0;
                        }
 
@@ -7538,7 +7533,6 @@ 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 stconn *cs = appctx_cs(appctx);
        struct certificate_ocsp *ocsp = NULL;
        BIO *bio = NULL;
        int write = -1;
@@ -7593,10 +7587,8 @@ static int cli_io_handler_show_ocspresponse(struct appctx *appctx)
                chunk_appendf(trash, "%s\n", tmp->area);
 
                node = ebmb_next(node);
-               if (ci_putchk(cs_ic(cs), trash) == -1) {
-                       cs_rx_room_blk(cs);
+               if (applet_putchk(appctx, trash) == -1)
                        goto yield;
-               }
        }
 
 end:
@@ -7674,7 +7666,6 @@ 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 stconn *cs = appctx_cs(appctx);
        struct list provider_names;
        struct provider_name *name;
 
@@ -7690,10 +7681,8 @@ static int cli_io_handler_show_providers(struct appctx *appctx)
 
        ssl_provider_clear_name_list(&provider_names);
 
-       if (ci_putchk(cs_ic(cs), trash) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putchk(appctx, trash) == -1)
                goto yield;
-       }
 
        return 1;
 
@@ -7805,7 +7794,6 @@ static int cli_io_handler_show_ocspresponse_detail(struct appctx *appctx)
 {
        struct buffer *trash = alloc_trash_chunk();
        struct certificate_ocsp *ocsp = appctx->svcctx;
-       struct stconn *cs = appctx_cs(appctx);
 
        if (trash == NULL)
                return 1;
@@ -7815,10 +7803,8 @@ static int cli_io_handler_show_ocspresponse_detail(struct appctx *appctx)
                return 1;
        }
 
-       if (ci_putchk(cs_ic(cs), trash) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putchk(appctx, trash) == -1)
                goto yield;
-       }
 
        appctx->svcctx = NULL;
        if (trash)
index 9d012bf904dfb750a4c29c14c0a5e3f72e8558b9..ce6e614ee4dbeb16ef6c5e02812b7e4416f5930c 100644 (file)
@@ -4565,10 +4565,8 @@ static int stats_dump_info_to_buffer(struct stconn *cs)
        else
                stats_dump_info_fields(&trash, info, ctx->flags);
 
-       if (ci_putchk(cs_ic(cs), &trash) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putchk(appctx, &trash) == -1)
                return 0;
-       }
 
        return 1;
 }
@@ -4787,16 +4785,14 @@ static void stats_dump_json_schema(struct buffer *out)
  * It returns 0 as long as it does not complete, non-zero upon completion.
  * No state is used.
  */
-static int stats_dump_json_schema_to_buffer(struct stconn *cs)
+static int stats_dump_json_schema_to_buffer(struct appctx *appctx)
 {
        chunk_reset(&trash);
 
        stats_dump_json_schema(&trash);
 
-       if (ci_putchk(cs_ic(cs), &trash) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putchk(appctx, &trash) == -1)
                return 0;
-       }
 
        return 1;
 }
@@ -5017,7 +5013,7 @@ static int cli_io_handler_dump_stat(struct appctx *appctx)
 
 static int cli_io_handler_dump_json_schema(struct appctx *appctx)
 {
-       return stats_dump_json_schema_to_buffer(appctx_cs(appctx));
+       return stats_dump_json_schema_to_buffer(appctx);
 }
 
 int stats_allocate_proxy_counters_internal(struct extra_counters **counters,
index 8c69dbe89180881351cbaa8c8fdbd2eec1f2460f..186181f5142751b3d0a4c0bb3506a00cdbc39afa 100644 (file)
@@ -4239,10 +4239,10 @@ enum {
  * and needs to be called again, otherwise non-zero.
  */
 static int table_dump_head_to_buffer(struct buffer *msg,
-                                     struct stconn *cs,
+                                     struct appctx *appctx,
                                      struct stktable *t, struct stktable *target)
 {
-       struct stream *s = __cs_strm(cs);
+       struct stream *s = __cs_strm(appctx_cs(appctx));
 
        chunk_appendf(msg, "# table: %s, type: %s, size:%d, used:%d\n",
                     t->id, stktable_types[t->type].kw, t->size, t->current);
@@ -4252,10 +4252,8 @@ static int table_dump_head_to_buffer(struct buffer *msg,
        if (target && (strm_li(s)->bind_conf->level & ACCESS_LVL_MASK) < ACCESS_LVL_OPER)
                chunk_appendf(msg, "# contents not dumped due to insufficient privileges\n");
 
-       if (ci_putchk(cs_ic(cs), msg) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putchk(appctx, msg) == -1)
                return 0;
-       }
 
        return 1;
 }
@@ -4265,7 +4263,7 @@ static int table_dump_head_to_buffer(struct buffer *msg,
  * and needs to be called again, otherwise non-zero.
  */
 static int table_dump_entry_to_buffer(struct buffer *msg,
-                                      struct stconn *cs,
+                                      struct appctx *appctx,
                                       struct stktable *t, struct stksess *entry)
 {
        int dt;
@@ -4379,10 +4377,8 @@ static int table_dump_entry_to_buffer(struct buffer *msg,
        }
        chunk_appendf(msg, "\n");
 
-       if (ci_putchk(cs_ic(cs), msg) == -1) {
-               cs_rx_room_blk(cs);
+       if (applet_putchk(appctx, msg) == -1)
                return 0;
-       }
 
        return 1;
 }
@@ -4408,7 +4404,6 @@ struct show_table_ctx {
  */
 static int table_process_entry_per_key(struct appctx *appctx, char **args)
 {
-       struct stconn *cs = appctx_cs(appctx);
        struct show_table_ctx *ctx = appctx->svcctx;
        struct stktable *t = ctx->target;
        struct stksess *ts;
@@ -4475,12 +4470,12 @@ static int table_process_entry_per_key(struct appctx *appctx, char **args)
                if (!ts)
                        return 1;
                chunk_reset(&trash);
-               if (!table_dump_head_to_buffer(&trash, cs, t, t)) {
+               if (!table_dump_head_to_buffer(&trash, appctx, t, t)) {
                        stktable_release(t, ts);
                        return 0;
                }
                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &ts->lock);
-               if (!table_dump_entry_to_buffer(&trash, cs, t, ts)) {
+               if (!table_dump_entry_to_buffer(&trash, appctx, t, ts)) {
                        HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &ts->lock);
                        stktable_release(t, ts);
                        return 0;
@@ -4706,7 +4701,7 @@ static int cli_io_handler_table(struct appctx *appctx)
                        }
 
                        if (ctx->t->size) {
-                               if (show && !table_dump_head_to_buffer(&trash, cs, ctx->t, ctx->target))
+                               if (show && !table_dump_head_to_buffer(&trash, appctx, ctx->t, ctx->target))
                                        return 0;
 
                                if (ctx->target &&
@@ -4782,7 +4777,7 @@ static int cli_io_handler_table(struct appctx *appctx)
                        }
 
                        if (show && !skip_entry &&
-                           !table_dump_entry_to_buffer(&trash, cs, ctx->t, ctx->entry)) {
+                           !table_dump_entry_to_buffer(&trash, appctx, ctx->t, ctx->entry)) {
                                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &ctx->entry->lock);
                                return 0;
                        }
index 99809ba6281cb441f404cf54a3459a21574930ef..5e0fd5802acda26e2151102f1a362066a59af013 100644 (file)
@@ -3166,7 +3166,7 @@ static int stats_dump_full_strm_to_buffer(struct stconn *cs, struct stream *strm
        if (ctx->section > 0 && ctx->uid != strm->uniq_id) {
                /* stream changed, no need to go any further */
                chunk_appendf(&trash, "  *** session terminated while we were watching it ***\n");
-               if (ci_putchk(cs_ic(cs), &trash) == -1)
+               if (applet_putchk(appctx, &trash) == -1)
                        goto full;
                goto done;
        }
@@ -3475,7 +3475,7 @@ static int stats_dump_full_strm_to_buffer(struct stconn *cs, struct stream *strm
                        chunk_appendf(&trash, "  current_rule=\"%s\" [%s:%d]\n", rule->kw->kw, rule->conf.file, rule->conf.line);
                }
 
-               if (ci_putchk(cs_ic(cs), &trash) == -1)
+               if (applet_putchk(appctx, &trash) == -1)
                        goto full;
 
                /* use other states to dump the contents */
@@ -3707,7 +3707,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx)
 
                chunk_appendf(&trash, "\n");
 
-               if (ci_putchk(cs_ic(cs), &trash) == -1) {
+               if (applet_putchk(appctx, &trash) == -1) {
                        /* let's try again later from this stream. We add ourselves into
                         * this stream's users so that it can remove us upon termination.
                         */
@@ -3726,7 +3726,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx)
                else
                        chunk_appendf(&trash, "Session not found.\n");
 
-               if (ci_putchk(cs_ic(cs), &trash) == -1)
+               if (applet_putchk(appctx, &trash) == -1)
                        goto full;
 
                ctx->target = NULL;
@@ -3739,7 +3739,6 @@ static int cli_io_handler_dump_sess(struct appctx *appctx)
        return 1;
  full:
        thread_release();
-       cs_rx_room_blk(cs);
        return 0;
 }