}
-static ngx_inline void
-ngx_http_v2_queue_frame(ngx_http_v2_connection_t *h2c,
- ngx_http_v2_out_frame_t *frame)
+/* all frames of a stream are queued at the same position */
+
+static ngx_inline ngx_http_v2_out_frame_t **
+ngx_http_v2_queue_position(ngx_http_v2_connection_t *h2c,
+ ngx_http_v2_stream_t *stream)
{
ngx_http_v2_out_frame_t **out;
break;
}
- if (ngx_http_v2_stream_precedes((*out)->stream, frame->stream)) {
+ if (ngx_http_v2_stream_precedes((*out)->stream, stream)) {
break;
}
}
+ return out;
+}
+
+
+static ngx_inline void
+ngx_http_v2_queue_frame(ngx_http_v2_out_frame_t **out,
+ ngx_http_v2_out_frame_t *frame)
+{
frame->next = *out;
*out = frame;
}
ngx_http_request_t *r;
ngx_http_v2_stream_t *stream;
ngx_http_v2_loc_conf_t *h2lcf;
- ngx_http_v2_out_frame_t *frame, *trailers;
+ ngx_http_v2_out_frame_t *frame, *trailers, **fn;
ngx_http_v2_connection_t *h2c;
r = fc->data;
trailers = NGX_HTTP_V2_NO_TRAILERS;
+ fn = ngx_http_v2_queue_position(h2c, stream);
+
#if (NGX_SUPPRESS_WARN)
cl = NULL;
#endif
return NGX_CHAIN_ERROR;
}
- ngx_http_v2_queue_frame(h2c, frame);
+ ngx_http_v2_queue_frame(fn, frame);
h2c->send_window -= frame_size;
if (in == NULL) {
if (trailers != NGX_HTTP_V2_NO_TRAILERS) {
- ngx_http_v2_queue_frame(h2c, trailers);
+ ngx_http_v2_queue_frame(fn, trailers);
stream->queued++;
}