From: Willy Tarreau Date: Thu, 15 Nov 2018 10:08:52 +0000 (+0100) Subject: MINOR: stream-int: replace si_cant_put() with si_rx_room_{blk,rdy}() X-Git-Tag: v1.9-dev7~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db398435aaa210ff5cbe56892d0aa8491d3c5dfa;p=thirdparty%2Fhaproxy.git MINOR: stream-int: replace si_cant_put() with si_rx_room_{blk,rdy}() Remaining calls to si_cant_put() were all for lack of room and were turned to si_rx_room_blk(). A few places where SI_FL_RXBLK_ROOM was cleared by hand were converted to si_rx_room_rdy(). The now unused si_cant_put() function was removed. --- diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h index d1c022c263..90e395655c 100644 --- a/include/proto/stream_interface.h +++ b/include/proto/stream_interface.h @@ -259,13 +259,6 @@ static inline int si_rx_endp_ready(const struct stream_interface *si) return !(si->flags & SI_FL_RX_WAIT_EP); } -/* Report that a stream interface failed to put some data into the input buffer */ -static inline void si_cant_put(struct stream_interface *si) -{ - si->flags |= SI_FL_RXBLK_ROOM; - si->flags &= ~SI_FL_RX_WAIT_EP; -} - /* The stream interface announces it is ready to try to deliver more data to the input buffer */ static inline void si_rx_endp_more(struct stream_interface *si) { @@ -306,6 +299,22 @@ static inline void si_rx_buff_blk(struct stream_interface *si) si->flags |= SI_FL_RXBLK_BUFF; } +/* Tell a stream interface some room was made in the input buffer */ +static inline void si_rx_room_rdy(struct stream_interface *si) +{ + si->flags &= ~SI_FL_RXBLK_ROOM; +} + +/* The stream interface announces it failed to put data into the input buffer + * by lack of room. Since it indicates a willingness to deliver data to the + * buffer that will have to be retried, we automatically clear RXBLK_ENDP to + * be called again as soon as RXBLK_ROOM is cleared. + */ +static inline void si_rx_room_blk(struct stream_interface *si) +{ + si->flags |= SI_FL_RXBLK_ROOM; +} + /* The stream interface announces it will never put new data into the input * buffer and that it's not waiting for its endpoint to deliver anything else. * This function obviously doesn't have a _rdy equivalent. diff --git a/src/cache.c b/src/cache.c index fdb0f256f6..9b77121b0a 100644 --- a/src/cache.c +++ b/src/cache.c @@ -617,7 +617,7 @@ static int cache_channel_row_data_get(struct appctx *appctx, int len) offset = 0; if (ret <= 0) { if (ret == -3 || ret == -1) { - si_cant_put(si); + si_rx_room_blk(si); break; } return -1; @@ -1142,7 +1142,7 @@ static int cli_io_handler_show_cache(struct appctx *appctx) 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(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } } @@ -1168,7 +1168,7 @@ static int cli_io_handler_show_cache(struct appctx *appctx) shctx_unlock(shctx_ptr(cache)); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } } diff --git a/src/cli.c b/src/cli.c index 6329db1ce3..199d25fcf9 100644 --- a/src/cli.c +++ b/src/cli.c @@ -590,7 +590,7 @@ static void cli_io_handler(struct appctx *appctx) * would want to return some info right after parsing. */ if (buffer_almost_full(si_ib(si))) { - si_cant_put(si); + si_rx_room_blk(si); break; } @@ -693,7 +693,7 @@ static void cli_io_handler(struct appctx *appctx) cli_get_severity_output(appctx)) != -1) appctx->st0 = CLI_ST_PROMPT; else - si_cant_put(si); + si_rx_room_blk(si); break; case CLI_ST_PRINT_FREE: { const char *msg = appctx->ctx.cli.err; @@ -706,7 +706,7 @@ static void cli_io_handler(struct appctx *appctx) appctx->st0 = CLI_ST_PROMPT; } else - si_cant_put(si); + si_rx_room_blk(si); break; } case CLI_ST_CALLBACK: /* use custom pointer */ @@ -746,7 +746,7 @@ static void cli_io_handler(struct appctx *appctx) if (ci_putstr(si_ic(si), prompt) != -1) appctx->st0 = CLI_ST_GETREQ; else - si_cant_put(si); + si_rx_room_blk(si); } /* If the output functions are still there, it means they require more room. */ @@ -834,7 +834,7 @@ static int cli_io_handler_show_env(struct appctx *appctx) chunk_printf(&trash, "%s\n", *var); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } if (appctx->st2 == STAT_ST_END) @@ -951,7 +951,7 @@ static int cli_io_handler_show_fd(struct appctx *appctx) chunk_appendf(&trash, "\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } skip: @@ -1008,7 +1008,7 @@ static int cli_io_handler_show_activity(struct appctx *appctx) if (ci_putchk(si_ic(si), &trash) == -1) { chunk_reset(&trash); chunk_printf(&trash, "[output too large, cannot dump]\n"); - si_cant_put(si); + si_rx_room_blk(si); } /* dump complete */ @@ -1030,7 +1030,7 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx) case STAT_ST_INIT: chunk_printf(&trash, "# socket lvl processes\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } appctx->st2 = STAT_ST_LIST; @@ -1099,7 +1099,7 @@ static int cli_io_handler_show_cli_sock(struct appctx *appctx) } if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } } @@ -1413,7 +1413,7 @@ static int cli_io_handler_show_proc(struct appctx *appctx) } if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } diff --git a/src/dns.c b/src/dns.c index 4ceda4d1f3..57bec21dcb 100644 --- a/src/dns.c +++ b/src/dns.c @@ -2030,7 +2030,7 @@ static int cli_io_handler_dump_resolvers_to_buffer(struct appctx *appctx) /* let's try again later from this session. We add ourselves into * this session's users so that it can remove us upon termination. */ - si->flags |= SI_FL_RXBLK_ROOM; + si_rx_room_blk(si); return 0; } /* fall through */ diff --git a/src/flt_spoe.c b/src/flt_spoe.c index edb853a662..72e1773a55 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -1156,7 +1156,7 @@ spoe_send_frame(struct appctx *appctx, char *buf, size_t framesz) ret = ci_putblk(si_ic(si), buf, framesz+4); if (ret <= 0) { if ((ret == -3 && b_is_null(&si_ic(si)->buf)) || ret == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 1; /* retry */ } SPOE_APPCTX(appctx)->status_code = SPOE_FRM_ERR_IO; diff --git a/src/hlua.c b/src/hlua.c index f7d2718869..2364317745 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -3833,7 +3833,7 @@ __LJMP static int hlua_applet_tcp_send_yield(lua_State *L, int status, lua_KCont * applet, and returns a yield. */ if (l < len) { - si_cant_put(si); + si_rx_room_blk(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_tcp_send_yield, TICK_ETERNITY, 0)); } @@ -4130,7 +4130,7 @@ __LJMP static int hlua_applet_http_getline_yield(lua_State *L, int status, lua_K * If ret is -1, we dont have room in the buffer, so we yield. */ if (ret == -1) { - si_cant_put(si); + si_rx_room_blk(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_getline_yield, TICK_ETERNITY, 0)); } appctx->appctx->ctx.hlua_apphttp.flags &= ~APPLET_100C; @@ -4216,7 +4216,7 @@ __LJMP static int hlua_applet_http_recv_yield(lua_State *L, int status, lua_KCon * If ret is -1, we dont have room in the buffer, so we yield. */ if (ret == -1) { - si_cant_put(si); + si_rx_room_blk(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_recv_yield, TICK_ETERNITY, 0)); } appctx->appctx->ctx.hlua_apphttp.flags &= ~APPLET_100C; @@ -4328,7 +4328,7 @@ __LJMP static int hlua_applet_http_send_yield(lua_State *L, int status, lua_KCon * applet, and returns a yield. */ if (l < len) { - si_cant_put(si); + si_rx_room_blk(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_send_yield, TICK_ETERNITY, 0)); } @@ -4468,7 +4468,7 @@ __LJMP static int hlua_applet_http_start_response_yield(lua_State *L, int status /* If ret is -1, we dont have room in the buffer, so we yield. */ if (ret == -1) { - si_cant_put(si); + si_rx_room_blk(si); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_http_start_response_yield, TICK_ETERNITY, 0)); } @@ -6775,7 +6775,7 @@ static void hlua_applet_http_fct(struct appctx *ctx) /* no enough space error. */ if (ret == -1) { - si_cant_put(si); + si_rx_room_blk(si); return; } @@ -7224,7 +7224,7 @@ static int hlua_cli_io_handler_fct(struct appctx *appctx) case HLUA_E_AGAIN: /* We want write. */ if (HLUA_IS_WAKERESWR(hlua)) - si_cant_put(si); + si_rx_room_blk(si); /* Set the timeout. */ if (hlua->wake_time != TICK_ETERNITY) task_schedule(hlua->task, hlua->wake_time); diff --git a/src/log.c b/src/log.c index 8962194686..b6f99bc292 100644 --- a/src/log.c +++ b/src/log.c @@ -2778,7 +2778,7 @@ static int cli_io_handler_show_startup_logs(struct appctx *appctx) const char *msg = (startup_logs ? startup_logs : "No startup alerts/warnings.\n"); if (ci_putstr(si_ic(si), msg) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } return 1; diff --git a/src/map.c b/src/map.c index 859ad8907c..7eb9e3647b 100644 --- a/src/map.c +++ b/src/map.c @@ -381,7 +381,7 @@ static int cli_io_handler_pat_list(struct appctx *appctx) */ LIST_ADDQ(&elt->back_refs, &appctx->ctx.map.bref.users); HA_SPIN_UNLOCK(PATREF_LOCK, &appctx->ctx.map.ref->lock); - si_cant_put(si); + si_rx_room_blk(si); return 0; } @@ -410,7 +410,7 @@ static int cli_io_handler_pats_list(struct appctx *appctx) chunk_reset(&trash); chunk_appendf(&trash, "# id (file) description\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } @@ -440,7 +440,7 @@ static int cli_io_handler_pats_list(struct appctx *appctx) /* let's try again later from this stream. We add ourselves into * this stream's users so that it can remove us upon termination. */ - si_cant_put(si); + si_rx_room_blk(si); return 0; } @@ -561,7 +561,7 @@ static int cli_io_handler_map_lookup(struct appctx *appctx) * this stream's users so that it can remove us upon termination. */ HA_SPIN_UNLOCK(PATREF_LOCK, &appctx->ctx.map.ref->lock); - si_cant_put(si); + si_rx_room_blk(si); return 0; } diff --git a/src/memory.c b/src/memory.c index ced9af5506..17ac1d1f35 100644 --- a/src/memory.c +++ b/src/memory.c @@ -514,7 +514,7 @@ static int cli_io_handler_dump_pools(struct appctx *appctx) dump_pools_to_trash(); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } return 1; diff --git a/src/peers.c b/src/peers.c index 649af83ffe..76ecf68bf6 100644 --- a/src/peers.c +++ b/src/peers.c @@ -1892,7 +1892,7 @@ out: HA_SPIN_UNLOCK(PEER_LOCK, &curpeer->lock); return; full: - si_cant_put(si); + si_rx_room_blk(si); goto out; } diff --git a/src/proxy.c b/src/proxy.c index 763b95de3c..d0b06d8eb1 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -1581,7 +1581,7 @@ static int dump_servers_state(struct stream_interface *si, struct buffer *buf) bk_f_forced_id, srv_f_forced_id, srv->hostname ? srv->hostname : "-", srv->svc_port, srvrecord ? srvrecord : "-"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } } @@ -1608,7 +1608,7 @@ static int cli_io_handler_servers_state(struct appctx *appctx) if (appctx->st2 == STAT_ST_HEAD) { chunk_printf(&trash, "%d\n# %s\n", SRV_STATE_FILE_VERSION, SRV_STATE_FILE_FIELD_NAMES); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } appctx->st2 = STAT_ST_INFO; @@ -1643,7 +1643,7 @@ static int cli_io_handler_show_backend(struct appctx *appctx) if (!appctx->ctx.cli.p0) { chunk_printf(&trash, "# name\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } appctx->ctx.cli.p0 = proxies_list; @@ -1662,7 +1662,7 @@ static int cli_io_handler_show_backend(struct appctx *appctx) chunk_appendf(&trash, "%s\n", curproxy->id); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } } @@ -2155,7 +2155,7 @@ static int cli_io_handler_show_errors(struct appctx *appctx) cant_send_unlock: HA_SPIN_UNLOCK(PROXY_LOCK, &appctx->ctx.errors.px->lock); cant_send: - si_cant_put(si); + si_rx_room_blk(si); return 0; } diff --git a/src/server.c b/src/server.c index 47eaee6a96..5a539ef9d8 100644 --- a/src/server.c +++ b/src/server.c @@ -4460,7 +4460,7 @@ static int cli_parse_get_weight(char **args, char *payload, struct appctx *appct snprintf(trash.area, trash.size, "%d (initial %d)\n", sv->uweight, sv->iweight); if (ci_putstr(si_ic(si), trash.area) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } return 1; diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 39d599cfd8..5b68ece2c5 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -8571,7 +8571,7 @@ static int cli_io_handler_tlskeys_files(struct appctx *appctx) { chunk_appendf(&trash, "# id (file)\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } @@ -8620,7 +8620,7 @@ static int cli_io_handler_tlskeys_files(struct appctx *appctx) { * this stream's users so that it can remove us upon termination. */ HA_RWLOCK_RDUNLOCK(TLSKEYS_REF_LOCK, &ref->lock); - si_cant_put(si); + si_rx_room_blk(si); return 0; } appctx->ctx.cli.i1++; @@ -8632,7 +8632,7 @@ static int cli_io_handler_tlskeys_files(struct appctx *appctx) { /* let's try again later from this stream. We add ourselves into * this stream's users so that it can remove us upon termination. */ - si_cant_put(si); + si_rx_room_blk(si); return 0; } diff --git a/src/stats.c b/src/stats.c index 31c4f8540d..ec61c09d0c 100644 --- a/src/stats.c +++ b/src/stats.c @@ -2034,7 +2034,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st if (appctx->ctx.stats.flags & STAT_FMT_HTML) { stats_dump_html_px_hdr(si, px, uri); if (ci_putchk(rep, &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } } @@ -2046,7 +2046,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st /* print the frontend */ if (stats_dump_fe_stats(si, px)) { if (ci_putchk(rep, &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } } @@ -2059,7 +2059,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st /* stats.l has been initialized above */ for (; appctx->ctx.stats.l != &px->conf.listeners; appctx->ctx.stats.l = l->by_fe.n) { if (buffer_almost_full(&rep->buf)) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } @@ -2078,7 +2078,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st /* print the frontend */ if (stats_dump_li_stats(si, px, l, flags)) { if (ci_putchk(rep, &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } } @@ -2092,7 +2092,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st /* stats.sv has been initialized above */ for (; appctx->ctx.stats.sv != NULL; appctx->ctx.stats.sv = sv->next) { if (buffer_almost_full(&rep->buf)) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } @@ -2122,7 +2122,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st if (stats_dump_sv_stats(si, px, flags, sv)) { if (ci_putchk(rep, &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } } @@ -2135,7 +2135,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st /* print the backend */ if (stats_dump_be_stats(si, px, flags)) { if (ci_putchk(rep, &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } } @@ -2147,7 +2147,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct proxy *px, st if (appctx->ctx.stats.flags & STAT_FMT_HTML) { stats_dump_html_px_end(si, px); if (ci_putchk(rep, &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } } @@ -2559,7 +2559,7 @@ static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_aut stats_dump_csv_header(); if (ci_putchk(rep, &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } @@ -2570,7 +2570,7 @@ static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_aut if (appctx->ctx.stats.flags & STAT_FMT_HTML) { stats_dump_html_info(si, uri); if (ci_putchk(rep, &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } } @@ -2584,7 +2584,7 @@ static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_aut /* dump proxies */ while (appctx->ctx.stats.px) { if (buffer_almost_full(&rep->buf)) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } @@ -2609,7 +2609,7 @@ static int stats_dump_stat_to_buffer(struct stream_interface *si, struct uri_aut else stats_dump_json_end(); if (ci_putchk(rep, &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } } @@ -2979,7 +2979,7 @@ static int stats_send_http_headers(struct stream_interface *si) chunk_appendf(&trash, "\r\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } @@ -3024,7 +3024,7 @@ static int stats_send_http_redirect(struct stream_interface *si) scope_txt); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } @@ -3085,7 +3085,7 @@ static void http_stats_io_handler(struct appctx *appctx) si_ic(si)->to_forward = 0; chunk_printf(&trash, "\r\n000000\r\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); si_ic(si)->to_forward = last_fwd; goto out; } @@ -3111,7 +3111,7 @@ static void http_stats_io_handler(struct appctx *appctx) if (last_len != data_len) { chunk_printf(&trash, "\r\n%06x\r\n", (last_len - data_len)); if (ci_putchk(si_ic(si), &trash) == -1) - si_cant_put(si); + si_rx_room_blk(si); si_ic(si)->total += (last_len - data_len); b_add(si_ib(si), last_len - data_len); @@ -3137,7 +3137,7 @@ static void http_stats_io_handler(struct appctx *appctx) if (appctx->ctx.stats.flags & STAT_CHUNKED) { chunk_printf(&trash, "\r\n0\r\n\r\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); goto out; } } @@ -3333,7 +3333,7 @@ static int stats_dump_info_to_buffer(struct stream_interface *si) stats_dump_info_fields(&trash, info); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } @@ -3561,7 +3561,7 @@ static int stats_dump_json_schema_to_buffer(struct stream_interface *si) stats_dump_json_schema(&trash); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } diff --git a/src/stick_table.c b/src/stick_table.c index 5e55b7a9b9..593b989380 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -3049,7 +3049,7 @@ static int table_dump_head_to_buffer(struct buffer *msg, chunk_appendf(msg, "# contents not dumped due to insufficient privileges\n"); if (ci_putchk(si_ic(si), msg) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } @@ -3123,7 +3123,7 @@ static int table_dump_entry_to_buffer(struct buffer *msg, chunk_appendf(msg, "\n"); if (ci_putchk(si_ic(si), msg) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } diff --git a/src/stream.c b/src/stream.c index da528b26e3..f4473e86d0 100644 --- a/src/stream.c +++ b/src/stream.c @@ -2782,7 +2782,7 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st /* stream changed, no need to go any further */ chunk_appendf(&trash, " *** session terminated while we were watching it ***\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } appctx->ctx.sess.uid = 0; @@ -3080,7 +3080,7 @@ static int stats_dump_full_strm_to_buffer(struct stream_interface *si, struct st (unsigned int)strm->res.buf.size); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); return 0; } @@ -3299,7 +3299,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx) /* let's try again later from this stream. We add ourselves into * this stream's users so that it can remove us upon termination. */ - si_cant_put(si); + si_rx_room_blk(si); LIST_ADDQ(&curr_strm->back_refs, &appctx->ctx.sess.bref.users); HA_SPIN_UNLOCK(STRMS_LOCK, &streams_lock); return 0; @@ -3317,7 +3317,7 @@ static int cli_io_handler_dump_sess(struct appctx *appctx) chunk_appendf(&trash, "Session not found.\n"); if (ci_putchk(si_ic(si), &trash) == -1) { - si_cant_put(si); + si_rx_room_blk(si); HA_SPIN_UNLOCK(STRMS_LOCK, &streams_lock); return 0; } diff --git a/src/stream_interface.c b/src/stream_interface.c index c349aac2e2..f88b4323b3 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -249,7 +249,7 @@ static void stream_int_chk_rcv(struct stream_interface *si) if (ic->pipe) { /* stop reading */ - si->flags |= SI_FL_RXBLK_ROOM; + si_rx_room_blk(si); } else { /* (re)start reading */ @@ -482,7 +482,7 @@ void stream_int_notify(struct stream_interface *si) if ((sio->flags & SI_FL_RXBLK_ROOM) && ((oc->flags & CF_WRITE_PARTIAL) || channel_is_empty(oc))) - sio->flags &= ~SI_FL_RXBLK_ROOM; + si_rx_room_rdy(sio); if (oc->flags & CF_DONT_READ) si_rx_chan_blk(sio); @@ -519,7 +519,7 @@ void stream_int_notify(struct stream_interface *si) * buffer or in the pipe. */ if (new_len < last_len) - si->flags &= ~SI_FL_RXBLK_ROOM; + si_rx_room_rdy(si); } if (!(ic->flags & CF_DONT_READ)) @@ -761,7 +761,7 @@ void stream_int_update(struct stream_interface *si) if (!channel_is_empty(ic)) { /* stop reading, imposed by channel's policy or contents */ - si_cant_put(si); + si_rx_room_blk(si); } else { /* (re)start reading and update timeout. Note: we don't recompute the timeout @@ -769,7 +769,7 @@ void stream_int_update(struct stream_interface *si) * update it if is was not yet set. The stream socket handler will already * have updated it if there has been a completed I/O. */ - si->flags &= ~SI_FL_RXBLK_ROOM; + si_rx_room_rdy(si); } if (si->flags & SI_FL_RXBLK_ANY & ~SI_FL_RX_WAIT_EP) ic->rex = TICK_ETERNITY; @@ -844,7 +844,7 @@ void si_update_both(struct stream_interface *si_f, struct stream_interface *si_b !(cs->flags & CS_FL_ERROR) && !(cs->conn->flags & CO_FL_ERROR)) { if (si_cs_send(cs)) - si_b->flags &= ~SI_FL_RXBLK_ROOM; + si_rx_room_rdy(si_b); } /* back stream-int */ @@ -856,7 +856,7 @@ void si_update_both(struct stream_interface *si_f, struct stream_interface *si_b !(cs->flags & CS_FL_ERROR) && !(cs->conn->flags & CO_FL_ERROR)) { if (si_cs_send(cs)) - si_f->flags &= ~SI_FL_RXBLK_ROOM; + si_rx_room_rdy(si_f); } /* let's recompute both sides states */ @@ -1205,7 +1205,7 @@ int si_cs_recv(struct conn_stream *cs) /* the pipe is full or we have read enough data that it * could soon be full. Let's stop before needing to poll. */ - si_cant_put(si); + si_rx_room_blk(si); goto done_recv; } @@ -1240,7 +1240,7 @@ int si_cs_recv(struct conn_stream *cs) ret = cs->conn->mux->rcv_buf(cs, &ic->buf, max, co_data(ic) ? CO_RFL_BUF_WET : 0); if (cs->flags & CS_FL_RCV_MORE) - si_cant_put(si); + si_rx_room_blk(si); if (ret <= 0) { break;