Mercurial > hg > nginx-quic
comparison src/event/quic/ngx_event_quic_streams.c @ 8414:915c2f7092ed quic
QUIC: ngx_quic_frames_stream_t made opaque.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 13 Apr 2021 11:49:52 +0300 |
parents | 41807e581de9 |
children | b4e6b7049984 |
comparison
equal
deleted
inserted
replaced
8413:46161c610919 | 8414:915c2f7092ed |
---|---|
365 if (sn->b == NULL) { | 365 if (sn->b == NULL) { |
366 ngx_destroy_pool(pool); | 366 ngx_destroy_pool(pool); |
367 return NULL; | 367 return NULL; |
368 } | 368 } |
369 | 369 |
370 ngx_queue_init(&sn->fs.frames); | 370 sn->fs = ngx_pcalloc(pool, sizeof(ngx_quic_frames_stream_t)); |
371 if (sn->fs == NULL) { | |
372 ngx_destroy_pool(pool); | |
373 return NULL; | |
374 } | |
375 | |
376 ngx_queue_init(&sn->fs->frames); | |
371 | 377 |
372 log = ngx_palloc(pool, sizeof(ngx_log_t)); | 378 log = ngx_palloc(pool, sizeof(ngx_log_t)); |
373 if (log == NULL) { | 379 if (log == NULL) { |
374 ngx_destroy_pool(pool); | 380 ngx_destroy_pool(pool); |
375 return NULL; | 381 return NULL; |
501 } | 507 } |
502 | 508 |
503 frame->level = ssl_encryption_application; | 509 frame->level = ssl_encryption_application; |
504 frame->type = NGX_QUIC_FT_MAX_STREAM_DATA; | 510 frame->type = NGX_QUIC_FT_MAX_STREAM_DATA; |
505 frame->u.max_stream_data.id = qs->id; | 511 frame->u.max_stream_data.id = qs->id; |
506 frame->u.max_stream_data.limit = qs->fs.received + (b->pos - b->start) | 512 frame->u.max_stream_data.limit = qs->fs->received + (b->pos - b->start) |
507 + (b->end - b->last); | 513 + (b->end - b->last); |
508 | 514 |
509 ngx_quic_queue_frame(qc, frame); | 515 ngx_quic_queue_frame(qc, frame); |
510 } | 516 } |
511 | 517 |
704 | 710 |
705 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, | 711 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
706 "quic stream id:0x%xL cleanup", qs->id); | 712 "quic stream id:0x%xL cleanup", qs->id); |
707 | 713 |
708 ngx_rbtree_delete(&qc->streams.tree, &qs->node); | 714 ngx_rbtree_delete(&qc->streams.tree, &qs->node); |
709 ngx_quic_free_frames(pc, &qs->fs.frames); | 715 ngx_quic_free_frames(pc, &qs->fs->frames); |
710 | 716 |
711 if (qc->closing) { | 717 if (qc->closing) { |
712 /* schedule handler call to continue ngx_quic_close_connection() */ | 718 /* schedule handler call to continue ngx_quic_close_connection() */ |
713 ngx_post_event(pc->read, &ngx_posted_events); | 719 ngx_post_event(pc->read, &ngx_posted_events); |
714 return; | 720 return; |
832 if (sn == NGX_QUIC_STREAM_GONE) { | 838 if (sn == NGX_QUIC_STREAM_GONE) { |
833 return NGX_OK; | 839 return NGX_OK; |
834 } | 840 } |
835 | 841 |
836 sc = sn->c; | 842 sc = sn->c; |
837 fs = &sn->fs; | 843 fs = sn->fs; |
838 b = sn->b; | 844 b = sn->b; |
839 window = b->end - b->last; | 845 window = b->end - b->last; |
840 | 846 |
841 if (last > window) { | 847 if (last > window) { |
842 qc->error = NGX_QUIC_ERR_FLOW_CONTROL_ERROR; | 848 qc->error = NGX_QUIC_ERR_FLOW_CONTROL_ERROR; |
853 sc->listening->handler(sc); | 859 sc->listening->handler(sc); |
854 | 860 |
855 return NGX_OK; | 861 return NGX_OK; |
856 } | 862 } |
857 | 863 |
858 fs = &sn->fs; | 864 fs = sn->fs; |
859 b = sn->b; | 865 b = sn->b; |
860 window = (b->pos - b->start) + (b->end - b->last); | 866 window = (b->pos - b->start) + (b->end - b->last); |
861 | 867 |
862 if (last > fs->received && last - fs->received > window) { | 868 if (last > fs->received && last - fs->received > window) { |
863 qc->error = NGX_QUIC_ERR_FLOW_CONTROL_ERROR; | 869 qc->error = NGX_QUIC_ERR_FLOW_CONTROL_ERROR; |
1017 | 1023 |
1018 sn->c->listening->handler(sn->c); | 1024 sn->c->listening->handler(sn->c); |
1019 | 1025 |
1020 } else { | 1026 } else { |
1021 b = sn->b; | 1027 b = sn->b; |
1022 n = sn->fs.received + (b->pos - b->start) + (b->end - b->last); | 1028 n = sn->fs->received + (b->pos - b->start) + (b->end - b->last); |
1023 } | 1029 } |
1024 | 1030 |
1025 frame = ngx_quic_alloc_frame(c); | 1031 frame = ngx_quic_alloc_frame(c); |
1026 if (frame == NULL) { | 1032 if (frame == NULL) { |
1027 return NGX_ERROR; | 1033 return NGX_ERROR; |