mirror of
https://github.com/nginx/nginx.git
synced 2025-06-22 13:51:12 +08:00
Double MAX_STREAMS on STREAMS_BLOCKED.
This commit is contained in:
parent
ea6809ac73
commit
3ba0d03a6e
@ -88,6 +88,8 @@ static ngx_int_t ngx_quic_handle_crypto_frame(ngx_connection_t *c,
|
||||
ngx_quic_header_t *pkt, ngx_quic_crypto_frame_t *frame);
|
||||
static ngx_int_t ngx_quic_handle_stream_frame(ngx_connection_t *c,
|
||||
ngx_quic_header_t *pkt, ngx_quic_stream_frame_t *frame);
|
||||
static ngx_int_t ngx_quic_handle_streams_blocked_frame(ngx_connection_t *c,
|
||||
ngx_quic_header_t *pkt, ngx_quic_streams_blocked_frame_t *f);
|
||||
|
||||
static void ngx_quic_queue_frame(ngx_quic_connection_t *qc,
|
||||
ngx_quic_frame_t *frame);
|
||||
@ -797,7 +799,15 @@ ngx_quic_payload_handler(ngx_connection_t *c, ngx_quic_header_t *pkt)
|
||||
|
||||
case NGX_QUIC_FT_STREAMS_BLOCKED:
|
||||
case NGX_QUIC_FT_STREAMS_BLOCKED2:
|
||||
/* TODO: handle; need ack ? */
|
||||
|
||||
if (ngx_quic_handle_streams_blocked_frame(c, pkt,
|
||||
&frame.u.streams_blocked)
|
||||
!= NGX_OK)
|
||||
{
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
ack_this = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -952,6 +962,33 @@ ngx_quic_handle_stream_frame(ngx_connection_t *c,
|
||||
}
|
||||
|
||||
|
||||
static ngx_int_t
|
||||
ngx_quic_handle_streams_blocked_frame(ngx_connection_t *c,
|
||||
ngx_quic_header_t *pkt, ngx_quic_streams_blocked_frame_t *f)
|
||||
{
|
||||
ngx_quic_frame_t *frame;
|
||||
|
||||
frame = ngx_pcalloc(c->pool, sizeof(ngx_quic_frame_t));
|
||||
if (frame == NULL) {
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
frame->level = pkt->level;
|
||||
frame->type = NGX_QUIC_FT_MAX_STREAMS;
|
||||
frame->u.max_streams.limit = f->limit * 2;
|
||||
frame->u.max_streams.bidi = f->bidi;
|
||||
|
||||
ngx_sprintf(frame->info, "MAX_STREAMS limit:%d bidi:%d level=%d",
|
||||
(int) frame->u.max_streams.limit,
|
||||
(int) frame->u.max_streams.bidi,
|
||||
frame->level);
|
||||
|
||||
ngx_quic_queue_frame(c->quic, frame);
|
||||
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ngx_quic_queue_frame(ngx_quic_connection_t *qc, ngx_quic_frame_t *frame)
|
||||
{
|
||||
|
@ -66,6 +66,8 @@ static size_t ngx_quic_create_ack(u_char *p, ngx_quic_ack_frame_t *ack);
|
||||
static size_t ngx_quic_create_crypto(u_char *p,
|
||||
ngx_quic_crypto_frame_t *crypto);
|
||||
static size_t ngx_quic_create_stream(u_char *p, ngx_quic_stream_frame_t *sf);
|
||||
static size_t ngx_quic_create_max_streams(u_char *p,
|
||||
ngx_quic_max_streams_frame_t *ms);
|
||||
static size_t ngx_quic_create_close(u_char *p, ngx_quic_close_frame_t *cl);
|
||||
|
||||
|
||||
@ -821,6 +823,9 @@ ngx_quic_create_frame(u_char *p, u_char *end, ngx_quic_frame_t *f)
|
||||
case NGX_QUIC_FT_CONNECTION_CLOSE:
|
||||
return ngx_quic_create_close(p, &f->u.close);
|
||||
|
||||
case NGX_QUIC_FT_MAX_STREAMS:
|
||||
return ngx_quic_create_max_streams(p, &f->u.max_streams);
|
||||
|
||||
default:
|
||||
/* BUG: unsupported frame type generated */
|
||||
return NGX_ERROR;
|
||||
@ -934,6 +939,30 @@ ngx_quic_create_stream(u_char *p, ngx_quic_stream_frame_t *sf)
|
||||
}
|
||||
|
||||
|
||||
static size_t
|
||||
ngx_quic_create_max_streams(u_char *p, ngx_quic_max_streams_frame_t *ms)
|
||||
{
|
||||
size_t len;
|
||||
u_char *start;
|
||||
ngx_uint_t type;
|
||||
|
||||
type = ms->bidi ? NGX_QUIC_FT_MAX_STREAMS : NGX_QUIC_FT_MAX_STREAMS2;
|
||||
|
||||
if (p == NULL) {
|
||||
len = ngx_quic_varint_len(type);
|
||||
len += ngx_quic_varint_len(ms->limit);
|
||||
return len;
|
||||
}
|
||||
|
||||
start = p;
|
||||
|
||||
ngx_quic_build_int(&p, type);
|
||||
ngx_quic_build_int(&p, ms->limit);
|
||||
|
||||
return p - start;
|
||||
}
|
||||
|
||||
|
||||
static size_t
|
||||
ngx_quic_create_close(u_char *p, ngx_quic_close_frame_t *cl)
|
||||
{
|
||||
|
@ -140,6 +140,12 @@ typedef struct {
|
||||
} ngx_quic_streams_blocked_frame_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint64_t limit;
|
||||
ngx_uint_t bidi; /* unsigned: bidi:1 */
|
||||
} ngx_quic_max_streams_frame_t;
|
||||
|
||||
|
||||
typedef struct ngx_quic_frame_s ngx_quic_frame_t;
|
||||
|
||||
struct ngx_quic_frame_s {
|
||||
@ -156,6 +162,7 @@ struct ngx_quic_frame_s {
|
||||
ngx_quic_reset_stream_frame_t reset_stream;
|
||||
ngx_quic_stop_sending_frame_t stop_sending;
|
||||
ngx_quic_streams_blocked_frame_t streams_blocked;
|
||||
ngx_quic_max_streams_frame_t max_streams;
|
||||
} u;
|
||||
u_char info[128]; // for debug
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user