From 18e066c2e7e6275d27383356c108cda0d17ad920 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 25 Oct 2018 10:28:27 +0200 Subject: [PATCH] MEDIUM: stream: always call si_cs_recv() after a failed buffer allocation 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stream.c b/src/stream.c index d27dae3a2..6f5372809 100644 --- a/src/stream.c +++ b/src/stream.c @@ -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: