BUG/MEDIUM: h2: Wake the task instead of calling h2_recv()/h2_process().

In a number of cases, we may end up recursively calling h2_recv() via
h2_process(), so just wake the tasklet up instead.
This commit is contained in:
Olivier Houchard 2018-09-24 18:02:03 +02:00 committed by Christopher Faulet
parent 21df6cc2f9
commit 61d322fa9e

View File

@ -284,8 +284,7 @@ static int h2_buf_available(void *target)
h2c->flags &= ~H2_CF_DEM_DALLOC; h2c->flags &= ~H2_CF_DEM_DALLOC;
if (h2_recv_allowed(h2c)) { if (h2_recv_allowed(h2c)) {
conn_xprt_want_recv(h2c->conn); conn_xprt_want_recv(h2c->conn);
if (h2_recv(h2c)) tasklet_wakeup(h2c->wait_list.task);
h2_process(h2c);
} }
return 1; return 1;
} }
@ -299,8 +298,7 @@ static int h2_buf_available(void *target)
h2c->flags &= ~H2_CF_DEM_MROOM; h2c->flags &= ~H2_CF_DEM_MROOM;
if (h2_recv_allowed(h2c)) { if (h2_recv_allowed(h2c)) {
conn_xprt_want_recv(h2c->conn); conn_xprt_want_recv(h2c->conn);
if (h2_recv(h2c)) tasklet_wakeup(h2c->wait_list.task);
h2_process(h2c);
} }
} }
return 1; return 1;
@ -312,8 +310,7 @@ static int h2_buf_available(void *target)
h2c->flags &= ~H2_CF_DEM_SALLOC; h2c->flags &= ~H2_CF_DEM_SALLOC;
if (h2_recv_allowed(h2c)) { if (h2_recv_allowed(h2c)) {
conn_xprt_want_recv(h2c->conn); conn_xprt_want_recv(h2c->conn);
if (h2_recv(h2c)) tasklet_wakeup(h2c->wait_list.task);
h2_process(h2c);
} }
return 1; return 1;
} }
@ -2577,8 +2574,7 @@ static void h2_update_poll(struct conn_stream *cs)
h2s->h2c->flags &= ~H2_CF_DEM_SFULL; h2s->h2c->flags &= ~H2_CF_DEM_SFULL;
if (h2s->h2c->dsi == h2s->id) { if (h2s->h2c->dsi == h2s->id) {
conn_xprt_want_recv(cs->conn); conn_xprt_want_recv(cs->conn);
if (h2_recv(h2s->h2c)) tasklet_wakeup(h2s->h2c->wait_list.task);
h2_process(h2s->h2c);
conn_xprt_want_send(cs->conn); conn_xprt_want_send(cs->conn);
} }
} }
@ -2625,7 +2621,7 @@ static void h2_detach(struct conn_stream *cs)
h2c->flags &= ~H2_CF_DEM_TOOMANY; h2c->flags &= ~H2_CF_DEM_TOOMANY;
if (h2_recv_allowed(h2c)) { if (h2_recv_allowed(h2c)) {
__conn_xprt_want_recv(h2c->conn); __conn_xprt_want_recv(h2c->conn);
h2_recv(h2c); tasklet_wakeup(h2c->wait_list.task);
conn_xprt_want_send(h2c->conn); conn_xprt_want_send(h2c->conn);
} }
} }
@ -2646,7 +2642,7 @@ static void h2_detach(struct conn_stream *cs)
h2c->flags &= ~H2_CF_DEM_BLOCK_ANY; h2c->flags &= ~H2_CF_DEM_BLOCK_ANY;
h2c->flags &= ~H2_CF_MUX_BLOCK_ANY; h2c->flags &= ~H2_CF_MUX_BLOCK_ANY;
conn_xprt_want_recv(cs->conn); conn_xprt_want_recv(cs->conn);
h2_recv(h2c); tasklet_wakeup(h2c->wait_list.task);
conn_xprt_want_send(cs->conn); conn_xprt_want_send(cs->conn);
} }