112 h2_put_u24(buffer, 4);
115 h2_put_u31(buffer + 5, stream_id);
361 uint32_t top_up = receive_window < target_window ? target_window - receive_window : 0
U;
362 return pending_update >
top_up ? pending_update :
top_up;
400 flow_control->target_window = cwist_http2_flow_control_retune_target(
406 increment = cwist_http2_flow_control_increment(
HTTP/2 wire integers in network byte order (private).
void cwist_http2_stream_flow_control_add_send_window(cwist_http2_stream_flow_control *flow_control, uint32_t increment)
Credit a stream send window from a WINDOW_UPDATE frame.
int cwist_http2_flow_control_maybe_window_update(cwist_http2_flow_control *flow_control, uint8_t *buffer, size_t buffer_len, size_t *written, uint64_t now_us, bool force)
Emit a connection-level WINDOW_UPDATE when enough credit is due.
void cwist_http2_flow_control_add_send_window(cwist_http2_flow_control *flow_control, uint32_t increment)
Credit the connection send window from a WINDOW_UPDATE frame.
void cwist_http2_stream_flow_control_consume(cwist_http2_stream_flow_control *flow_control, uint32_t bytes)
Record application-consumed bytes for a stream.
bool cwist_http2_stream_flow_control_receive(cwist_http2_stream_flow_control *flow_control, uint32_t bytes)
Account received DATA bytes against a stream receive window.
void cwist_http2_flow_control_update_rtt(cwist_http2_flow_control *flow_control, uint64_t rtt_sample_us)
Feed a new RTT sample into the smoothed estimator and retune.
void cwist_http2_flow_control_consume(cwist_http2_flow_control *flow_control, uint32_t bytes)
Record application-consumed bytes for the connection.
bool cwist_http2_flow_control_reserve_send(cwist_http2_flow_control *connection_flow_control, cwist_http2_stream_flow_control *stream_flow_control, uint32_t bytes, uint64_t now_us)
Reserve send credit for an outgoing write.
bool cwist_http2_flow_control_receive(cwist_http2_flow_control *flow_control, uint32_t bytes)
Account received DATA bytes against the connection receive window.
size_t cwist_http2_flow_control_pacing_allowance(cwist_http2_flow_control *connection_flow_control, const cwist_http2_stream_flow_control *stream_flow_control, size_t requested, uint64_t now_us)
Compute how much of a send request may proceed right now.
int cwist_http2_stream_flow_control_maybe_window_update(cwist_http2_flow_control *connection_flow_control, cwist_http2_stream_flow_control *stream_flow_control, uint8_t *buffer, size_t buffer_len, size_t *written, uint64_t now_us, bool force)
Emit a stream-level WINDOW_UPDATE when enough credit is due.
void cwist_http2_stream_flow_control_init(cwist_http2_stream_flow_control *flow_control, uint32_t stream_id, uint32_t initial_stream_window, uint32_t max_stream_window)
Initialize per-stream flow-control state.
void cwist_http2_flow_control_init(cwist_http2_flow_control *flow_control, uint32_t initial_connection_window, uint32_t max_connection_window)
Initialize connection-level flow-control state.
#define CWIST_HTTP2_INITIAL_STREAM_WINDOW
#define CWIST_HTTP2_MAX_WINDOW
#define CWIST_HTTP2_INITIAL_CONNECTION_WINDOW
@ CWIST_HTTP2_NETWORK_QUALITY_NORMAL
@ CWIST_HTTP2_NETWORK_QUALITY_HIGH_RTT
@ CWIST_HTTP2_NETWORK_QUALITY_UNSTABLE