QUIC: ngx_quic_frames_stream_t made opaque.

This commit is contained in:
Sergey Kandaurov 2021-04-13 11:49:52 +03:00
parent 0d1149dce5
commit cab188a0a1
4 changed files with 23 additions and 15 deletions

View file

@ -70,13 +70,7 @@ typedef struct {
} ngx_quic_conf_t; } ngx_quic_conf_t;
typedef struct { typedef struct ngx_quic_frames_stream_s ngx_quic_frames_stream_t;
uint64_t sent;
uint64_t received;
ngx_queue_t frames; /* reorder queue */
size_t total; /* size of buffered data */
} ngx_quic_frames_stream_t;
struct ngx_quic_stream_s { struct ngx_quic_stream_s {
ngx_rbtree_node_t node; ngx_rbtree_node_t node;
@ -86,7 +80,7 @@ struct ngx_quic_stream_s {
uint64_t acked; uint64_t acked;
uint64_t send_max_data; uint64_t send_max_data;
ngx_buf_t *b; ngx_buf_t *b;
ngx_quic_frames_stream_t fs; ngx_quic_frames_stream_t *fs;
ngx_uint_t cancelable; /* unsigned cancelable:1; */ ngx_uint_t cancelable; /* unsigned cancelable:1; */
}; };

View file

@ -498,7 +498,7 @@ ngx_quic_resend_frames(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx)
} }
b = sn->b; 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) { if (f->u.max_stream_data.limit < n) {
f->u.max_stream_data.limit = n; f->u.max_stream_data.limit = n;

View file

@ -98,6 +98,14 @@ typedef struct {
} ngx_quic_congestion_t; } 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 * 12.3. Packet Numbers
* *

View file

@ -367,7 +367,13 @@ ngx_quic_create_stream(ngx_connection_t *c, uint64_t id, size_t rcvbuf_size)
return NULL; 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)); log = ngx_palloc(pool, sizeof(ngx_log_t));
if (log == NULL) { 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->level = ssl_encryption_application;
frame->type = NGX_QUIC_FT_MAX_STREAM_DATA; frame->type = NGX_QUIC_FT_MAX_STREAM_DATA;
frame->u.max_stream_data.id = qs->id; 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); + (b->end - b->last);
ngx_quic_queue_frame(qc, frame); 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); "quic stream id:0x%xL cleanup", qs->id);
ngx_rbtree_delete(&qc->streams.tree, &qs->node); 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) { if (qc->closing) {
/* schedule handler call to continue ngx_quic_close_connection() */ /* 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; sc = sn->c;
fs = &sn->fs; fs = sn->fs;
b = sn->b; b = sn->b;
window = b->end - b->last; 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; return NGX_OK;
} }
fs = &sn->fs; fs = sn->fs;
b = sn->b; b = sn->b;
window = (b->pos - b->start) + (b->end - b->last); 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 { } else {
b = sn->b; 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); frame = ngx_quic_alloc_frame(c);