]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stream-int: replace channel_alloc_buffer() with si_alloc_ibuf() everywhere
authorWilly Tarreau <w@1wt.eu>
Thu, 25 Oct 2018 08:21:41 +0000 (10:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 28 Oct 2018 12:47:00 +0000 (13:47 +0100)
Well that's only 3 places (applet.c, stream_interface.c, hlua.c). This
ensures we always clear SI_FL_WAIT_ROOM before setting it on failure,
so that it is granted that SI_FL_WAIT_ROOM always indicates a lack of
room for doing an operation, including the inability to allocate a
buffer for this.

src/applet.c
src/hlua.c
src/stream_interface.c

index d7fbb53eb67843131acaef720a9847a440111c1b..6911ab4a9e536e1ccfed0d8be9f6e79b583d0386 100644 (file)
@@ -36,7 +36,7 @@ struct task *task_run_applet(struct task *t, void *context, unsigned short state
         * applet in all cases. So this is the applet responsibility to
         * check if this buffer was allocated or not. This let a chance
         * for applets to do some other processing if needed. */
-       if (!channel_alloc_buffer(si_ic(si), &app->buffer_wait))
+       if (!si_alloc_ibuf(si, &app->buffer_wait))
                si_applet_cant_put(si);
 
        /* We always pretend the applet can't get and doesn't want to
index 44fb04a7984c47f67172fdd49f313252e0610065..6ad3c822d1f693338d3d11443d8b06eb574052b9 100644 (file)
@@ -2030,7 +2030,7 @@ static int hlua_socket_write_yield(struct lua_State *L,int status, lua_KContext
         * the request buffer if its not required.
         */
        if (s->req.buf.size == 0) {
-               if (!channel_alloc_buffer(&s->req, &appctx->buffer_wait))
+               if (!si_alloc_ibuf(si, &appctx->buffer_wait))
                        goto hlua_socket_write_yield_return;
        }
 
index e585b1fe4f77e728214edc4768c7306da466b2e0..8574b4ca30a9ebded5f6f8f195cecd141b095d0e 100644 (file)
@@ -1150,10 +1150,8 @@ int si_cs_recv(struct conn_stream *cs)
        }
 
        /* now we'll need a input buffer for the stream */
-       if (!channel_alloc_buffer(ic, &(si_strm(si)->buffer_wait))) {
-               si->flags |= SI_FL_WAIT_ROOM;
+       if (!si_alloc_ibuf(si, &(si_strm(si)->buffer_wait)))
                goto end_recv;
-       }
 
        /* Important note : if we're called with POLL_IN|POLL_HUP, it means the read polling
         * was enabled, which implies that the recv buffer was not full. So we have a guarantee