comparison src/event/quic/ngx_event_quic_streams.c @ 8784:7d32c3c93678 quic

QUIC: call stream read handler on new data arrival. This was broken in b3f6ad181df4.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 26 May 2021 13:07:06 +0300
parents 60c6e8d8d3ae
children af33d1ef1c3c
comparison
equal deleted inserted replaced
8783:60c6e8d8d3ae 8784:7d32c3c93678
812 ngx_quic_handle_stream_frame(ngx_connection_t *c, ngx_quic_header_t *pkt, 812 ngx_quic_handle_stream_frame(ngx_connection_t *c, ngx_quic_header_t *pkt,
813 ngx_quic_frame_t *frame) 813 ngx_quic_frame_t *frame)
814 { 814 {
815 uint64_t last; 815 uint64_t last;
816 ngx_pool_t *pool; 816 ngx_pool_t *pool;
817 ngx_event_t *rev;
817 ngx_connection_t *sc; 818 ngx_connection_t *sc;
818 ngx_quic_stream_t *qs; 819 ngx_quic_stream_t *qs;
819 ngx_quic_connection_t *qc; 820 ngx_quic_connection_t *qc;
820 ngx_quic_stream_frame_t *f; 821 ngx_quic_stream_frame_t *f;
821 822
893 if (f->offset < qs->recv_offset) { 894 if (f->offset < qs->recv_offset) {
894 ngx_quic_trim_bufs(frame->data, qs->recv_offset - f->offset); 895 ngx_quic_trim_bufs(frame->data, qs->recv_offset - f->offset);
895 f->offset = qs->recv_offset; 896 f->offset = qs->recv_offset;
896 } 897 }
897 898
898 if (f->offset == qs->recv_offset) { 899 rev = qs->connection->read;
899 qs->connection->read->ready = 1;
900 }
901 900
902 if (f->fin) { 901 if (f->fin) {
903 if (qs->final_size != (uint64_t) -1 && qs->final_size != last) { 902 if (qs->final_size != (uint64_t) -1 && qs->final_size != last) {
904 qc->error = NGX_QUIC_ERR_FINAL_SIZE_ERROR; 903 qc->error = NGX_QUIC_ERR_FINAL_SIZE_ERROR;
905 return NGX_ERROR; 904 return NGX_ERROR;
908 if (qs->recv_last > last) { 907 if (qs->recv_last > last) {
909 qc->error = NGX_QUIC_ERR_FINAL_SIZE_ERROR; 908 qc->error = NGX_QUIC_ERR_FINAL_SIZE_ERROR;
910 return NGX_ERROR; 909 return NGX_ERROR;
911 } 910 }
912 911
913 qs->connection->read->pending_eof = 1; 912 rev->pending_eof = 1;
914 qs->final_size = last; 913 qs->final_size = last;
915 } 914 }
916 915
917 return ngx_quic_order_bufs(c, &qs->in, frame->data, 916 if (ngx_quic_order_bufs(c, &qs->in, frame->data,
918 f->offset - qs->recv_offset); 917 f->offset - qs->recv_offset)
918 != NGX_OK)
919 {
920 return NGX_ERROR;
921 }
922
923 if (f->offset == qs->recv_offset) {
924 rev->ready = 1;
925
926 if (rev->active) {
927 rev->handler(rev);
928 }
929 }
930
931 return NGX_OK;
919 932
920 cleanup: 933 cleanup:
921 934
922 pool = sc->pool; 935 pool = sc->pool;
923 936