Re-try to process requests while we're sucesseful synchronously
processing them
@@ -174,6 +174,10 @@ static int can_run_requests(h2o_http2_conn_t *conn)
static void run_pending_requests(h2o_http2_conn_t *conn)
{
h2o_linklist_t *link, *lnext;
+ int ran_one_request;
+
+ do {
+ ran_one_request = 0;
for (link = conn->_pending_reqs.next; link != &conn->_pending_reqs && can_run_requests(conn); link = lnext) {
/* fetch and detach a pending stream */
@@ -195,12 +199,15 @@ static void run_pending_requests(h2o_http2_conn_t *conn)
}
h2o_linklist_unlink(&stream->_refs.link);
+ ran_one_request = 1;
/* handle it */
if (!h2o_http2_stream_is_push(stream->stream_id) && conn->pull_stream_ids.max_processed < stream->stream_id)
conn->pull_stream_ids.max_processed = stream->stream_id;
h2o_process_request(&stream->req);
}
+
+ } while (ran_one_request && !h2o_linklist_is_empty(&conn->_pending_reqs));
}
static void execute_or_enqueue_request(h2o_http2_conn_t *conn, h2o_http2_stream_t *stream)
