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.
diff --git a/src/mux_h1.c b/src/mux_h1.c
index 854099d..8de76d7 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -2429,20 +2429,21 @@
{
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;