Commit d2e5058e authored by Martin Blix Grydeland's avatar Martin Blix Grydeland Committed by Dridi Boukelmoune

Redo H/2 tx data handling

This implements stream data handling using a buffer between the H/2
session thread and each stream thread. This is needed to avoid head of
line blocking on the session socket when a data frame is received for a
stream thread that is not yet ready to receive it.

The buffer used will have to be as large as the send window the peer
expects at the time the stream is opened. This will typically be 65535
unless the h2_initial_window_size parameter has been changed.

Stream window updates will then be issued only once data is removed from
the buffer by the request body being consumed from the request handling
thread, limited in size to what space is then available in the buffer.

Conflicts:
	bin/varnishd/http2/cache_http2_proto.c
parent a1049d93
......@@ -113,6 +113,16 @@ enum h2_stream_e {
#define H2_FRAME_FLAGS(l,u,v) extern const uint8_t H2FF_##u;
#include "tbl/h2_frames.h"
struct h2_rxbuf {
unsigned magic;
#define H2_RXBUF_MAGIC 0x73f9fb27
unsigned size;
uint64_t tail;
uint64_t head;
struct stv_buffer *stvbuf;
uint8_t data[];
};
struct h2_req {
unsigned magic;
#define H2_REQ_MAGIC 0x03411584
......@@ -131,7 +141,7 @@ struct h2_req {
/* Where to wake this stream up */
struct worker *wrk;
ssize_t reqbody_bytes;
struct h2_rxbuf *rxbuf;
VTAILQ_ENTRY(h2_req) tx_list;
h2_error error;
......@@ -146,7 +156,6 @@ struct h2_sess {
#define H2_SESS_MAGIC 0xa16f7e4b
pthread_t rxthr;
struct h2_req *mailcall;
pthread_cond_t *cond;
pthread_cond_t winupd_cond[1];
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment