]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stream: always call si_cs_recv() after a failed buffer allocation
authorWilly Tarreau <w@1wt.eu>
Thu, 25 Oct 2018 08:28:27 +0000 (10:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 28 Oct 2018 12:47:00 +0000 (13:47 +0100)
If a buffer allocation failed, we have SI_FL_WAIT_ROOM set and c_size(buf)
being zero. It's the only moment where we have a new opportunity to try to
allocate this buffer. However we don't want to waste our time trying this
if both are non-null since it indicates missing room without any changed
condition.

src/stream.c

index d27dae3a225f45a61ef216a45553cd628a2499c0..6f5372809eac72783120c120c347546256cbc912 100644 (file)
@@ -1676,7 +1676,7 @@ struct task *process_stream(struct task *t, void *context, unsigned short state)
                    co_data(si_oc(si_f)))
                        si_cs_send(cs);
                if (!(si_f->wait_event.wait_reason & SUB_CAN_RECV) &&
-                   !(si_f->flags & SI_FL_WAIT_ROOM))
+                   (!(si_f->flags & SI_FL_WAIT_ROOM) || !c_size(req)))
                        si_cs_recv(cs);
        }
        cs = objt_cs(si_b->end);
@@ -1685,7 +1685,7 @@ struct task *process_stream(struct task *t, void *context, unsigned short state)
                    co_data(si_oc(si_b)))
                        si_cs_send(cs);
                if (!(si_b->wait_event.wait_reason & SUB_CAN_RECV) &&
-                   !(si_b->flags & SI_FL_WAIT_ROOM))
+                   (!(si_b->flags & SI_FL_WAIT_ROOM) || !c_size(res)))
                si_cs_recv(cs);
        }
 redo: