"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;
}
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;
}
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++) {
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)
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;
{
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;
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;
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;
- }
}
}
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. */
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++;
#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;
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
{
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;
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);
}
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;
done:
return 1;
full:
- cs_rx_room_blk(cs);
return 0;
}
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;
}
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;
(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;
/* 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 */
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 */
}
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;
}
* 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 */
}
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;
}
}
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;
}
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:
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:
*/
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
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;
}
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;
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;
}
- 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;
* 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;
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;
}
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;
}
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;
*/
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;
}
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;
}
}
"# 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)
*/
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;
}
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;
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;
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;
/* 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;
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;
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 {
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);
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;
}
return 1;
full:
/* the output buffer is full, retry later */
- cs_rx_room_blk(cs);
return 0;
}
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;
}
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;
/* 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;
}
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;
}
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;
}
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)
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;
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;
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);
{
#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;
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);
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:
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 */
/* 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 */
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:
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 */
/* 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 */
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;
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;
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)
}
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;
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;
}
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);
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)
}
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;
{
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)
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);
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)
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) {
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;
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:
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 */
/* 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 */
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:
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
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++;
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;
}
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;
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:
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;
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;
{
struct buffer *trash = alloc_trash_chunk();
struct certificate_ocsp *ocsp = appctx->svcctx;
- struct stconn *cs = appctx_cs(appctx);
if (trash == NULL)
return 1;
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)
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;
}
* 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;
}
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,
* 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);
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;
}
* 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;
}
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;
}
*/
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;
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;
}
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 &&
}
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;
}
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;
}
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 */
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.
*/
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;
return 1;
full:
thread_release();
- cs_rx_room_blk(cs);
return 0;
}