]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: h1: Don't wake the H1 tasklet if we got the whole request.
authorOlivier Houchard <ohouchard@haproxy.com>
Fri, 26 Jul 2019 13:12:38 +0000 (15:12 +0200)
committerOlivier Houchard <cognet@ci0.org>
Fri, 26 Jul 2019 15:13:21 +0000 (17:13 +0200)
In h1_rcv_buf(), don't wake the H1 tasklet to attempt to receive more data
if we got the whole request. It will lead to a recv and maybe to a subscribe
while it may not be needed.
If the connection is keep alive, the tasklet will be woken up later by
h1_detach(), so that we'll be able to get the next request, or an end of
connection.

src/mux_h1.c

index 854099de3ddc7039eed5e87f7b674b60a69bece6..8de76d736c0335799c35ccb52224e83e6ada3eaa 100644 (file)
@@ -2429,20 +2429,21 @@ static size_t h1_rcv_buf(struct conn_stream *cs, struct buffer *buf, size_t coun
 {
        struct h1s *h1s = cs->ctx;
        struct h1c *h1c = h1s->h1c;
+       struct h1m *h1m = (!conn_is_back(cs->conn) ? &h1s->req : &h1s->res);
        size_t ret = 0;
 
        if (!(h1c->flags & H1C_F_IN_ALLOC))
                ret = h1_process_input(h1c, buf, count);
 
        if (flags & CO_RFL_BUF_FLUSH) {
-               struct h1m *h1m = (!conn_is_back(cs->conn) ? &h1s->req : &h1s->res);
 
                if (h1m->state != H1_MSG_TUNNEL || (h1m->state == H1_MSG_DATA && h1m->curr_len))
                        h1s->flags |= H1S_F_BUF_FLUSH;
        }
        else if (ret > 0 || (h1s->flags & H1S_F_SPLICED_DATA)) {
                h1s->flags &= ~H1S_F_SPLICED_DATA;
-               if (!(h1c->wait_event.events & SUB_RETRY_RECV))
+               if (h1m->state != H1_MSG_DONE &&
+                               !(h1c->wait_event.events & SUB_RETRY_RECV))
                        tasklet_wakeup(h1c->wait_event.tasklet);
        }
        return ret;