From dedd30610bf534eb7fb3ca4d1993137d4d853f1f Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Fri, 26 Jul 2019 15:12:38 +0200 Subject: [PATCH] MEDIUM: h1: Don't wake the H1 tasklet if we got the whole request. 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mux_h1.c b/src/mux_h1.c index 854099de3d..8de76d736c 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -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; -- 2.39.5