Mercurial > hg > nginx-quic
comparison src/event/ngx_event_quic_transport.c @ 7862:fb7422074258 quic
Added generation of CC frames with error on connection termination.
When an error occurs, then c->quic->error field may be populated
with an appropriate error code, and the CONNECTION CLOSE frame will be
sent to the peer before the connection is closed. Otherwise, the error
treated as internal and INTERNAL_ERROR code is sent.
The pkt->error field is populated by functions processing packets to
indicate an error when it does not fit into pass/fail return status.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 14 May 2020 15:54:45 +0300 |
parents | 52d0c4832570 |
children | 81f85c479d7e |
comparison
equal
deleted
inserted
replaced
7861:52d0c4832570 | 7862:fb7422074258 |
---|---|
566 | 566 |
567 p = start; | 567 p = start; |
568 | 568 |
569 p = ngx_quic_parse_int(p, end, &varint); | 569 p = ngx_quic_parse_int(p, end, &varint); |
570 if (p == NULL) { | 570 if (p == NULL) { |
571 pkt->error = NGX_QUIC_ERR_FRAME_ENCODING_ERROR; | |
571 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, | 572 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, |
572 "quic failed to obtain quic frame type"); | 573 "quic failed to obtain quic frame type"); |
573 return NGX_ERROR; | 574 return NGX_ERROR; |
574 } | 575 } |
575 | 576 |
576 f->type = varint; | 577 f->type = varint; |
577 | 578 |
578 if (ngx_quic_frame_allowed(pkt, f->type) != NGX_OK) { | 579 if (ngx_quic_frame_allowed(pkt, f->type) != NGX_OK) { |
579 return NGX_DECLINED; | 580 pkt->error = NGX_QUIC_ERR_PROTOCOL_VIOLATION; |
581 return NGX_ERROR; | |
580 } | 582 } |
581 | 583 |
582 switch (f->type) { | 584 switch (f->type) { |
583 | 585 |
584 case NGX_QUIC_FT_CRYPTO: | 586 case NGX_QUIC_FT_CRYPTO: |
1000 } | 1002 } |
1001 | 1003 |
1002 return p - start; | 1004 return p - start; |
1003 | 1005 |
1004 error: | 1006 error: |
1007 | |
1008 pkt->error = NGX_QUIC_ERR_FRAME_ENCODING_ERROR; | |
1005 | 1009 |
1006 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, | 1010 ngx_log_error(NGX_LOG_INFO, pkt->log, 0, |
1007 "quic failed to parse frame type 0x%xi", f->type); | 1011 "quic failed to parse frame type 0x%xi", f->type); |
1008 | 1012 |
1009 return NGX_ERROR; | 1013 return NGX_ERROR; |