From 4b962a41791fa2e9648323f765cc542e32bd82ff Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 15 Nov 2018 11:03:21 +0100 Subject: [PATCH] MEDIUM: stream-int: fix the si_cant_put() calls used for buffer readiness A number of calls to si_cant_put() were used in fact to request being called back once a buffer is available. These ones are not needed anymore since si_alloc_ibuf() already sets the SI_FL_RXBLK_BUFF flag when called in appctx context. Those called with a foreign stream-int are simply turned to si_rx_buff_blk(). --- src/cache.c | 4 +++- src/cli.c | 4 +++- src/hlua.c | 4 ++-- src/stats.c | 4 +++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/cache.c b/src/cache.c index 35568bc557..fdb0f256f6 100644 --- a/src/cache.c +++ b/src/cache.c @@ -644,7 +644,9 @@ static void http_cache_io_handler(struct appctx *appctx) /* Check if the input buffer is avalaible. */ if (res->buf.size == 0) { - si_cant_put(si); + /* buf.size==0 means we failed to get a buffer and were + * already subscribed to a wait list to get a buffer. + */ goto out; } diff --git a/src/cli.c b/src/cli.c index 720a9b4516..6329db1ce3 100644 --- a/src/cli.c +++ b/src/cli.c @@ -550,7 +550,9 @@ static void cli_io_handler(struct appctx *appctx) /* Check if the input buffer is avalaible. */ if (res->buf.size == 0) { - si_cant_put(si); + /* buf.size==0 means we failed to get a buffer and were + * already subscribed to a wait list to get a buffer. + */ goto out; } diff --git a/src/hlua.c b/src/hlua.c index ad0f9f92ee..f7d2718869 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -2942,7 +2942,7 @@ __LJMP static int hlua_channel_append_yield(lua_State *L, int status, lua_KConte * the request buffer if its not required. */ if (chn->buf.size == 0) { - si_cant_put(chn_prod(chn)); + si_rx_buff_blk(chn_prod(chn)); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_channel_append_yield, TICK_ETERNITY, 0)); } @@ -3036,7 +3036,7 @@ __LJMP static int hlua_channel_send_yield(lua_State *L, int status, lua_KContext * the request buffer if its not required. */ if (chn->buf.size == 0) { - si_cant_put(chn_prod(chn)); + si_rx_buff_blk(chn_prod(chn)); MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_channel_send_yield, TICK_ETERNITY, 0)); } diff --git a/src/stats.c b/src/stats.c index 0574260d99..31c4f8540d 100644 --- a/src/stats.c +++ b/src/stats.c @@ -3049,7 +3049,9 @@ static void http_stats_io_handler(struct appctx *appctx) /* Check if the input buffer is avalaible. */ if (res->buf.size == 0) { - si_cant_put(si); + /* already subscribed, we'll be called later once the buffer is + * available. + */ goto out; } -- 2.47.3