mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-08 08:07:10 +02:00
MEDIUM: applet: make the applets only use si_applet_{cant|want|stop}_{get|put}
The applets don't fiddle with SI_FL_WAIT_ROOM anymore, instead they indicate what they want, possibly that they failed (eg: WAIT_ROOM), and it's done() / update() which finally updates the WAIT_* flags according to the channels' and stream interface's states. This solves the issue of the pauses during a "show sess" without creating busy loops.
This commit is contained in:
parent
eb406dc73c
commit
fe127937a8
@ -37,6 +37,13 @@ void applet_run_active()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We always pretend the applet can't get and doesn't want to
|
||||||
|
* put, it's up to it to change this if needed. This ensures
|
||||||
|
* that one applet which ignores any event will not spin.
|
||||||
|
*/
|
||||||
|
si_applet_cant_get(si);
|
||||||
|
si_applet_stop_put(si);
|
||||||
|
|
||||||
curr->applet->fct(curr);
|
curr->applet->fct(curr);
|
||||||
si_applet_done(si);
|
si_applet_done(si);
|
||||||
}
|
}
|
||||||
|
@ -557,7 +557,7 @@ static int stats_dump_table_head_to_buffer(struct chunk *msg, struct stream_inte
|
|||||||
chunk_appendf(msg, "# contents not dumped due to insufficient privileges\n");
|
chunk_appendf(msg, "# contents not dumped due to insufficient privileges\n");
|
||||||
|
|
||||||
if (bi_putchk(si_ic(si), msg) == -1) {
|
if (bi_putchk(si_ic(si), msg) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,7 +630,7 @@ static int stats_dump_table_entry_to_buffer(struct chunk *msg, struct stream_int
|
|||||||
chunk_appendf(msg, "\n");
|
chunk_appendf(msg, "\n");
|
||||||
|
|
||||||
if (bi_putchk(si_ic(si), msg) == -1) {
|
if (bi_putchk(si_ic(si), msg) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1311,7 +1311,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
|
|||||||
/* return server's effective weight at the moment */
|
/* return server's effective weight at the moment */
|
||||||
snprintf(trash.str, trash.size, "%d (initial %d)\n", sv->uweight, sv->iweight);
|
snprintf(trash.str, trash.size, "%d (initial %d)\n", sv->uweight, sv->iweight);
|
||||||
if (bi_putstr(si_ic(si), trash.str) == -1)
|
if (bi_putstr(si_ic(si), trash.str) == -1)
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -2247,7 +2247,7 @@ static void cli_io_handler(struct appctx *appctx)
|
|||||||
* would want to return some info right after parsing.
|
* would want to return some info right after parsing.
|
||||||
*/
|
*/
|
||||||
if (buffer_almost_full(si_ib(si))) {
|
if (buffer_almost_full(si_ib(si))) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2326,7 +2326,7 @@ static void cli_io_handler(struct appctx *appctx)
|
|||||||
if (bi_putstr(si_ic(si), appctx->ctx.cli.msg) != -1)
|
if (bi_putstr(si_ic(si), appctx->ctx.cli.msg) != -1)
|
||||||
appctx->st0 = STAT_CLI_PROMPT;
|
appctx->st0 = STAT_CLI_PROMPT;
|
||||||
else
|
else
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
break;
|
break;
|
||||||
case STAT_CLI_PRINT_FREE:
|
case STAT_CLI_PRINT_FREE:
|
||||||
if (bi_putstr(si_ic(si), appctx->ctx.cli.err) != -1) {
|
if (bi_putstr(si_ic(si), appctx->ctx.cli.err) != -1) {
|
||||||
@ -2334,7 +2334,7 @@ static void cli_io_handler(struct appctx *appctx)
|
|||||||
appctx->st0 = STAT_CLI_PROMPT;
|
appctx->st0 = STAT_CLI_PROMPT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
break;
|
break;
|
||||||
case STAT_CLI_O_INFO:
|
case STAT_CLI_O_INFO:
|
||||||
if (stats_dump_info_to_buffer(si))
|
if (stats_dump_info_to_buffer(si))
|
||||||
@ -2384,7 +2384,7 @@ static void cli_io_handler(struct appctx *appctx)
|
|||||||
if (bi_putstr(si_ic(si), appctx->st1 ? "\n> " : "\n") != -1)
|
if (bi_putstr(si_ic(si), appctx->st1 ? "\n> " : "\n") != -1)
|
||||||
appctx->st0 = STAT_CLI_GETREQ;
|
appctx->st0 = STAT_CLI_GETREQ;
|
||||||
else
|
else
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the output functions are still there, it means they require more room. */
|
/* If the output functions are still there, it means they require more room. */
|
||||||
@ -2541,7 +2541,7 @@ static int stats_dump_info_to_buffer(struct stream_interface *si)
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (bi_putchk(si_ic(si), &trash) == -1) {
|
if (bi_putchk(si_ic(si), &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2556,7 +2556,7 @@ static int stats_dump_pools_to_buffer(struct stream_interface *si)
|
|||||||
{
|
{
|
||||||
dump_pools_to_trash();
|
dump_pools_to_trash();
|
||||||
if (bi_putchk(si_ic(si), &trash) == -1) {
|
if (bi_putchk(si_ic(si), &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -3809,7 +3809,7 @@ static int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy
|
|||||||
if (appctx->ctx.stats.flags & STAT_FMT_HTML) {
|
if (appctx->ctx.stats.flags & STAT_FMT_HTML) {
|
||||||
stats_dump_html_px_hdr(si, px, uri);
|
stats_dump_html_px_hdr(si, px, uri);
|
||||||
if (bi_putchk(rep, &trash) == -1) {
|
if (bi_putchk(rep, &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3821,7 +3821,7 @@ static int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy
|
|||||||
/* print the frontend */
|
/* print the frontend */
|
||||||
if (stats_dump_fe_stats(si, px)) {
|
if (stats_dump_fe_stats(si, px)) {
|
||||||
if (bi_putchk(rep, &trash) == -1) {
|
if (bi_putchk(rep, &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3834,7 +3834,7 @@ static int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy
|
|||||||
/* stats.l has been initialized above */
|
/* stats.l has been initialized above */
|
||||||
for (; appctx->ctx.stats.l != &px->conf.listeners; appctx->ctx.stats.l = l->by_fe.n) {
|
for (; appctx->ctx.stats.l != &px->conf.listeners; appctx->ctx.stats.l = l->by_fe.n) {
|
||||||
if (buffer_almost_full(rep->buf)) {
|
if (buffer_almost_full(rep->buf)) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3853,7 +3853,7 @@ static int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy
|
|||||||
/* print the frontend */
|
/* print the frontend */
|
||||||
if (stats_dump_li_stats(si, px, l, uri ? uri->flags : 0)) {
|
if (stats_dump_li_stats(si, px, l, uri ? uri->flags : 0)) {
|
||||||
if (bi_putchk(rep, &trash) == -1) {
|
if (bi_putchk(rep, &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3870,7 +3870,7 @@ static int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy
|
|||||||
enum srv_stats_colour sv_colour;
|
enum srv_stats_colour sv_colour;
|
||||||
|
|
||||||
if (buffer_almost_full(rep->buf)) {
|
if (buffer_almost_full(rep->buf)) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3949,7 +3949,7 @@ static int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy
|
|||||||
|
|
||||||
if (stats_dump_sv_stats(si, px, uri ? uri->flags : 0, sv, sv_state, sv_colour)) {
|
if (stats_dump_sv_stats(si, px, uri ? uri->flags : 0, sv, sv_state, sv_colour)) {
|
||||||
if (bi_putchk(rep, &trash) == -1) {
|
if (bi_putchk(rep, &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3962,7 +3962,7 @@ static int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy
|
|||||||
/* print the backend */
|
/* print the backend */
|
||||||
if (stats_dump_be_stats(si, px, uri ? uri->flags : 0)) {
|
if (stats_dump_be_stats(si, px, uri ? uri->flags : 0)) {
|
||||||
if (bi_putchk(rep, &trash) == -1) {
|
if (bi_putchk(rep, &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3974,7 +3974,7 @@ static int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy
|
|||||||
if (appctx->ctx.stats.flags & STAT_FMT_HTML) {
|
if (appctx->ctx.stats.flags & STAT_FMT_HTML) {
|
||||||
stats_dump_html_px_end(si, px);
|
stats_dump_html_px_end(si, px);
|
||||||
if (bi_putchk(rep, &trash) == -1) {
|
if (bi_putchk(rep, &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4367,7 +4367,7 @@ static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_aut
|
|||||||
stats_dump_csv_header();
|
stats_dump_csv_header();
|
||||||
|
|
||||||
if (bi_putchk(rep, &trash) == -1) {
|
if (bi_putchk(rep, &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4378,7 +4378,7 @@ static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_aut
|
|||||||
if (appctx->ctx.stats.flags & STAT_FMT_HTML) {
|
if (appctx->ctx.stats.flags & STAT_FMT_HTML) {
|
||||||
stats_dump_html_info(si, uri);
|
stats_dump_html_info(si, uri);
|
||||||
if (bi_putchk(rep, &trash) == -1) {
|
if (bi_putchk(rep, &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4392,7 +4392,7 @@ static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_aut
|
|||||||
/* dump proxies */
|
/* dump proxies */
|
||||||
while (appctx->ctx.stats.px) {
|
while (appctx->ctx.stats.px) {
|
||||||
if (buffer_almost_full(rep->buf)) {
|
if (buffer_almost_full(rep->buf)) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4414,7 +4414,7 @@ static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_aut
|
|||||||
if (appctx->ctx.stats.flags & STAT_FMT_HTML) {
|
if (appctx->ctx.stats.flags & STAT_FMT_HTML) {
|
||||||
stats_dump_html_end();
|
stats_dump_html_end();
|
||||||
if (bi_putchk(rep, &trash) == -1) {
|
if (bi_putchk(rep, &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4784,7 +4784,7 @@ static int stats_send_http_headers(struct stream_interface *si)
|
|||||||
s->logs.tv_request = now;
|
s->logs.tv_request = now;
|
||||||
|
|
||||||
if (bi_putchk(si_ic(si), &trash) == -1) {
|
if (bi_putchk(si_ic(si), &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4831,7 +4831,7 @@ static int stats_send_http_redirect(struct stream_interface *si)
|
|||||||
s->logs.tv_request = now;
|
s->logs.tv_request = now;
|
||||||
|
|
||||||
if (bi_putchk(si_ic(si), &trash) == -1) {
|
if (bi_putchk(si_ic(si), &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4883,7 +4883,7 @@ static void http_stats_io_handler(struct appctx *appctx)
|
|||||||
si_ic(si)->to_forward = 0;
|
si_ic(si)->to_forward = 0;
|
||||||
chunk_printf(&trash, "\r\n000000\r\n");
|
chunk_printf(&trash, "\r\n000000\r\n");
|
||||||
if (bi_putchk(si_ic(si), &trash) == -1) {
|
if (bi_putchk(si_ic(si), &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
si_ic(si)->to_forward = last_fwd;
|
si_ic(si)->to_forward = last_fwd;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -4909,7 +4909,7 @@ static void http_stats_io_handler(struct appctx *appctx)
|
|||||||
if (last_len != data_len) {
|
if (last_len != data_len) {
|
||||||
chunk_printf(&trash, "\r\n%06x\r\n", (last_len - data_len));
|
chunk_printf(&trash, "\r\n%06x\r\n", (last_len - data_len));
|
||||||
if (bi_putchk(si_ic(si), &trash) == -1)
|
if (bi_putchk(si_ic(si), &trash) == -1)
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
|
|
||||||
si_ic(si)->total += (last_len - data_len);
|
si_ic(si)->total += (last_len - data_len);
|
||||||
si_ib(si)->i += (last_len - data_len);
|
si_ib(si)->i += (last_len - data_len);
|
||||||
@ -4935,7 +4935,7 @@ static void http_stats_io_handler(struct appctx *appctx)
|
|||||||
if (appctx->ctx.stats.flags & STAT_CHUNKED) {
|
if (appctx->ctx.stats.flags & STAT_CHUNKED) {
|
||||||
chunk_printf(&trash, "\r\n0\r\n\r\n");
|
chunk_printf(&trash, "\r\n0\r\n\r\n");
|
||||||
if (bi_putchk(si_ic(si), &trash) == -1) {
|
if (bi_putchk(si_ic(si), &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5024,7 +5024,7 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct st
|
|||||||
/* stream changed, no need to go any further */
|
/* stream changed, no need to go any further */
|
||||||
chunk_appendf(&trash, " *** session terminated while we were watching it ***\n");
|
chunk_appendf(&trash, " *** session terminated while we were watching it ***\n");
|
||||||
if (bi_putchk(si_ic(si), &trash) == -1) {
|
if (bi_putchk(si_ic(si), &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
appctx->ctx.sess.uid = 0;
|
appctx->ctx.sess.uid = 0;
|
||||||
@ -5307,7 +5307,7 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct st
|
|||||||
sess->res.buf->size);
|
sess->res.buf->size);
|
||||||
|
|
||||||
if (bi_putchk(si_ic(si), &trash) == -1) {
|
if (bi_putchk(si_ic(si), &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5332,7 +5332,7 @@ static int stats_pats_list(struct stream_interface *si)
|
|||||||
chunk_reset(&trash);
|
chunk_reset(&trash);
|
||||||
chunk_appendf(&trash, "# id (file) description\n");
|
chunk_appendf(&trash, "# id (file) description\n");
|
||||||
if (bi_putchk(si_ic(si), &trash) == -1) {
|
if (bi_putchk(si_ic(si), &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5362,7 +5362,7 @@ static int stats_pats_list(struct stream_interface *si)
|
|||||||
/* let's try again later from this stream. We add ourselves into
|
/* let's try again later from this stream. We add ourselves into
|
||||||
* this stream's users so that it can remove us upon termination.
|
* this stream's users so that it can remove us upon termination.
|
||||||
*/
|
*/
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5481,7 +5481,7 @@ static int stats_map_lookup(struct stream_interface *si)
|
|||||||
/* let's try again later from this stream. We add ourselves into
|
/* let's try again later from this stream. We add ourselves into
|
||||||
* this stream's users so that it can remove us upon termination.
|
* this stream's users so that it can remove us upon termination.
|
||||||
*/
|
*/
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5532,7 +5532,7 @@ static int stats_pat_list(struct stream_interface *si)
|
|||||||
/* let's try again later from this stream. We add ourselves into
|
/* let's try again later from this stream. We add ourselves into
|
||||||
* this stream's users so that it can remove us upon termination.
|
* this stream's users so that it can remove us upon termination.
|
||||||
*/
|
*/
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5737,7 +5737,7 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si)
|
|||||||
/* let's try again later from this stream. We add ourselves into
|
/* let's try again later from this stream. We add ourselves into
|
||||||
* this stream's users so that it can remove us upon termination.
|
* this stream's users so that it can remove us upon termination.
|
||||||
*/
|
*/
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
LIST_ADDQ(&curr_sess->back_refs, &appctx->ctx.sess.bref.users);
|
LIST_ADDQ(&curr_sess->back_refs, &appctx->ctx.sess.bref.users);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -5754,7 +5754,7 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si)
|
|||||||
chunk_appendf(&trash, "Session not found.\n");
|
chunk_appendf(&trash, "Session not found.\n");
|
||||||
|
|
||||||
if (bi_putchk(si_ic(si), &trash) == -1) {
|
if (bi_putchk(si_ic(si), &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6035,7 +6035,7 @@ static int stats_dump_errors_to_buffer(struct stream_interface *si)
|
|||||||
|
|
||||||
if (bi_putchk(si_ic(si), &trash) == -1) {
|
if (bi_putchk(si_ic(si), &trash) == -1) {
|
||||||
/* Socket buffer full. Let's try again later from the same point */
|
/* Socket buffer full. Let's try again later from the same point */
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6120,7 +6120,7 @@ static int stats_dump_errors_to_buffer(struct stream_interface *si)
|
|||||||
|
|
||||||
if (bi_putchk(si_ic(si), &trash) == -1) {
|
if (bi_putchk(si_ic(si), &trash) == -1) {
|
||||||
/* Socket buffer full. Let's try again later from the same point */
|
/* Socket buffer full. Let's try again later from the same point */
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
appctx->ctx.errors.ptr = 0;
|
appctx->ctx.errors.ptr = 0;
|
||||||
@ -6132,7 +6132,7 @@ static int stats_dump_errors_to_buffer(struct stream_interface *si)
|
|||||||
chunk_appendf(&trash,
|
chunk_appendf(&trash,
|
||||||
" WARNING! update detected on this snapshot, dump interrupted. Please re-check!\n");
|
" WARNING! update detected on this snapshot, dump interrupted. Please re-check!\n");
|
||||||
if (bi_putchk(si_ic(si), &trash) == -1) {
|
if (bi_putchk(si_ic(si), &trash) == -1) {
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
goto next;
|
goto next;
|
||||||
@ -6150,7 +6150,7 @@ static int stats_dump_errors_to_buffer(struct stream_interface *si)
|
|||||||
|
|
||||||
if (bi_putchk(si_ic(si), &trash) == -1) {
|
if (bi_putchk(si_ic(si), &trash) == -1) {
|
||||||
/* Socket buffer full. Let's try again later from the same point */
|
/* Socket buffer full. Let's try again later from the same point */
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
appctx->ctx.errors.ptr = newptr;
|
appctx->ctx.errors.ptr = newptr;
|
||||||
|
@ -1046,7 +1046,7 @@ static void peer_io_handler(struct appctx *appctx)
|
|||||||
si_oc(si)->flags |= CF_READ_DONTWAIT;
|
si_oc(si)->flags |= CF_READ_DONTWAIT;
|
||||||
return;
|
return;
|
||||||
full:
|
full:
|
||||||
si->flags |= SI_FL_WAIT_ROOM;
|
si_applet_cant_put(si);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ struct stream *stream_new(struct session *sess, struct task *t, enum obj_type *o
|
|||||||
if (conn)
|
if (conn)
|
||||||
conn_data_want_recv(conn);
|
conn_data_want_recv(conn);
|
||||||
else if (appctx)
|
else if (appctx)
|
||||||
s->si[0].flags |= SI_FL_WAIT_DATA;
|
si_applet_want_get(&s->si[0]);
|
||||||
|
|
||||||
if (sess->fe->accept && sess->fe->accept(s) < 0)
|
if (sess->fe->accept && sess->fe->accept(s) < 0)
|
||||||
goto out_fail_accept;
|
goto out_fail_accept;
|
||||||
|
@ -393,7 +393,7 @@ struct appctx *stream_int_register_handler(struct stream_interface *si, struct a
|
|||||||
if (!appctx)
|
if (!appctx)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
si->flags |= SI_FL_WAIT_DATA;
|
si_applet_cant_get(si);
|
||||||
appctx_wakeup(appctx);
|
appctx_wakeup(appctx);
|
||||||
return si_appctx(si);
|
return si_appctx(si);
|
||||||
}
|
}
|
||||||
@ -1433,14 +1433,9 @@ void si_applet_done(struct stream_interface *si)
|
|||||||
ic->rex = tick_add_ifset(now_ms, ic->rto);
|
ic->rex = tick_add_ifset(now_ms, ic->rto);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get away from the active list if we can't work anymore, that is
|
/* get away from the active list if we can't work anymore. */
|
||||||
* we're blocked both for reads or writes or once both sides are closed.
|
if (((si->flags & (SI_FL_WANT_PUT|SI_FL_WAIT_ROOM)) != SI_FL_WANT_PUT) &&
|
||||||
* FIXME: we may have a problem here with bidirectional applets which
|
((si->flags & (SI_FL_WANT_GET|SI_FL_WAIT_DATA)) != SI_FL_WANT_GET))
|
||||||
* might block on a single direction while the other one is still free.
|
|
||||||
*/
|
|
||||||
if ((si->flags & (SI_FL_WAIT_ROOM|SI_FL_WAIT_DATA)) ||
|
|
||||||
(ic->flags & CF_DONT_READ) ||
|
|
||||||
(ic->flags & CF_SHUTR && oc->flags & CF_SHUTW))
|
|
||||||
appctx_pause(si_appctx(si));
|
appctx_pause(si_appctx(si));
|
||||||
|
|
||||||
/* wake the task up only when needed */
|
/* wake the task up only when needed */
|
||||||
@ -1531,10 +1526,11 @@ void stream_int_update_applet(struct stream_interface *si)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(si->flags & (SI_FL_WAIT_ROOM|SI_FL_WAIT_DATA)) &&
|
if (((si->flags & (SI_FL_WANT_PUT|SI_FL_WAIT_ROOM)) == SI_FL_WANT_PUT) ||
|
||||||
!(ic->flags & CF_DONT_READ) &&
|
((si->flags & (SI_FL_WANT_GET|SI_FL_WAIT_DATA)) == SI_FL_WANT_GET))
|
||||||
(!(ic->flags & CF_SHUTR) || !(oc->flags & CF_SHUTW)))
|
|
||||||
appctx_wakeup(si_appctx(si));
|
appctx_wakeup(si_appctx(si));
|
||||||
|
else
|
||||||
|
appctx_pause(si_appctx(si));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user