]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stream-int: fix the si_cant_put() calls used for buffer readiness
authorWilly Tarreau <w@1wt.eu>
Thu, 15 Nov 2018 10:03:21 +0000 (11:03 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 18 Nov 2018 20:41:48 +0000 (21:41 +0100)
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
src/cli.c
src/hlua.c
src/stats.c

index 35568bc5577958d8c8c21e77c1248ce67c1dc985..fdb0f256f6bcdf25264d76f92d3e97cd73273edb 100644 (file)
@@ -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;
        }
 
index 720a9b4516575bce1799248dab0d40d6e4af462d..6329db1ce335c57e6abd8f26f551db1d4e87ca89 100644 (file)
--- 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;
        }
 
index ad0f9f92ee953043ce32389d68a2402a2fa851b3..f7d2718869e35c18ff3c0cfec30a97d4a8f531bb 100644 (file)
@@ -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));
        }
 
index 0574260d997ee926faa1b70e59663267b0a55d71..31c4f8540d425a0dfa4985efe85935414bd957ba 100644 (file)
@@ -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;
        }