diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2021-04-13 11:49:52 +0300 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2021-04-13 11:49:52 +0300 |
commit | 792117312d4fafba5af68b5c2fff51c58dcd3bc0 (patch) | |
tree | b94503c966917e5f9c543e669cb7e40f067c4dd5 /src | |
parent | 2fd1aac46d654905242ee2a0d0b5dc6997fd8569 (diff) | |
download | nginx-792117312d4fafba5af68b5c2fff51c58dcd3bc0.tar.gz nginx-792117312d4fafba5af68b5c2fff51c58dcd3bc0.zip |
QUIC: ngx_quic_frames_stream_t made opaque.
Diffstat (limited to 'src')
-rw-r--r-- | src/event/quic/ngx_event_quic.h | 10 | ||||
-rw-r--r-- | src/event/quic/ngx_event_quic_ack.c | 2 | ||||
-rw-r--r-- | src/event/quic/ngx_event_quic_connection.h | 8 | ||||
-rw-r--r-- | src/event/quic/ngx_event_quic_streams.c | 18 |
4 files changed, 23 insertions, 15 deletions
diff --git a/src/event/quic/ngx_event_quic.h b/src/event/quic/ngx_event_quic.h index 0066c96e6..66395dbcf 100644 --- a/src/event/quic/ngx_event_quic.h +++ b/src/event/quic/ngx_event_quic.h @@ -70,13 +70,7 @@ typedef struct { } ngx_quic_conf_t; -typedef struct { - uint64_t sent; - uint64_t received; - ngx_queue_t frames; /* reorder queue */ - size_t total; /* size of buffered data */ -} ngx_quic_frames_stream_t; - +typedef struct ngx_quic_frames_stream_s ngx_quic_frames_stream_t; struct ngx_quic_stream_s { ngx_rbtree_node_t node; @@ -86,7 +80,7 @@ struct ngx_quic_stream_s { uint64_t acked; uint64_t send_max_data; ngx_buf_t *b; - ngx_quic_frames_stream_t fs; + ngx_quic_frames_stream_t *fs; ngx_uint_t cancelable; /* unsigned cancelable:1; */ }; diff --git a/src/event/quic/ngx_event_quic_ack.c b/src/event/quic/ngx_event_quic_ack.c index 8f78ac51e..fc72ae13d 100644 --- a/src/event/quic/ngx_event_quic_ack.c +++ b/src/event/quic/ngx_event_quic_ack.c @@ -498,7 +498,7 @@ ngx_quic_resend_frames(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx) } b = sn->b; - n = sn->fs.received + (b->pos - b->start) + (b->end - b->last); + n = sn->fs->received + (b->pos - b->start) + (b->end - b->last); if (f->u.max_stream_data.limit < n) { f->u.max_stream_data.limit = n; diff --git a/src/event/quic/ngx_event_quic_connection.h b/src/event/quic/ngx_event_quic_connection.h index eb8507050..992397a66 100644 --- a/src/event/quic/ngx_event_quic_connection.h +++ b/src/event/quic/ngx_event_quic_connection.h @@ -98,6 +98,14 @@ typedef struct { } ngx_quic_congestion_t; +struct ngx_quic_frames_stream_s { + uint64_t sent; + uint64_t received; + ngx_queue_t frames; /* reorder queue */ + size_t total; /* size of buffered data */ +}; + + /* * 12.3. Packet Numbers * diff --git a/src/event/quic/ngx_event_quic_streams.c b/src/event/quic/ngx_event_quic_streams.c index 90d6bcea3..1174ea11e 100644 --- a/src/event/quic/ngx_event_quic_streams.c +++ b/src/event/quic/ngx_event_quic_streams.c @@ -367,7 +367,13 @@ ngx_quic_create_stream(ngx_connection_t *c, uint64_t id, size_t rcvbuf_size) return NULL; } - ngx_queue_init(&sn->fs.frames); + sn->fs = ngx_pcalloc(pool, sizeof(ngx_quic_frames_stream_t)); + if (sn->fs == NULL) { + ngx_destroy_pool(pool); + return NULL; + } + + ngx_queue_init(&sn->fs->frames); log = ngx_palloc(pool, sizeof(ngx_log_t)); if (log == NULL) { @@ -503,7 +509,7 @@ ngx_quic_stream_recv(ngx_connection_t *c, u_char *buf, size_t size) frame->level = ssl_encryption_application; frame->type = NGX_QUIC_FT_MAX_STREAM_DATA; frame->u.max_stream_data.id = qs->id; - frame->u.max_stream_data.limit = qs->fs.received + (b->pos - b->start) + frame->u.max_stream_data.limit = qs->fs->received + (b->pos - b->start) + (b->end - b->last); ngx_quic_queue_frame(qc, frame); @@ -706,7 +712,7 @@ ngx_quic_stream_cleanup_handler(void *data) "quic stream id:0x%xL cleanup", qs->id); ngx_rbtree_delete(&qc->streams.tree, &qs->node); - ngx_quic_free_frames(pc, &qs->fs.frames); + ngx_quic_free_frames(pc, &qs->fs->frames); if (qc->closing) { /* schedule handler call to continue ngx_quic_close_connection() */ @@ -834,7 +840,7 @@ ngx_quic_handle_stream_frame(ngx_connection_t *c, ngx_quic_header_t *pkt, } sc = sn->c; - fs = &sn->fs; + fs = sn->fs; b = sn->b; window = b->end - b->last; @@ -855,7 +861,7 @@ ngx_quic_handle_stream_frame(ngx_connection_t *c, ngx_quic_header_t *pkt, return NGX_OK; } - fs = &sn->fs; + fs = sn->fs; b = sn->b; window = (b->pos - b->start) + (b->end - b->last); @@ -1019,7 +1025,7 @@ ngx_quic_handle_stream_data_blocked_frame(ngx_connection_t *c, } else { b = sn->b; - n = sn->fs.received + (b->pos - b->start) + (b->end - b->last); + n = sn->fs->received + (b->pos - b->start) + (b->end - b->last); } frame = ngx_quic_alloc_frame(c); |