comparison src/event/ngx_event_quic_transport.c @ 8249:3f4b407fa0b8 quic

Added parsing of CONNECTION_CLOSE2 frame (0x1D). The difference is that error code refers to application namespace, i.e. quic error names cannot be used to convert it to string.
author Vladimir Homutov <vl@nginx.com>
date Fri, 20 Mar 2020 14:50:05 +0300
parents e9891e8ee975
children 8f9cb6d66662
comparison
equal deleted inserted replaced
8248:abb7c1a4c9d5 8249:3f4b407fa0b8
620 "NCID: { seq=%ui retire=%ui len=%ui}", 620 "NCID: { seq=%ui retire=%ui len=%ui}",
621 f->u.ncid.seqnum, f->u.ncid.retire, f->u.ncid.len); 621 f->u.ncid.seqnum, f->u.ncid.retire, f->u.ncid.len);
622 break; 622 break;
623 623
624 case NGX_QUIC_FT_CONNECTION_CLOSE: 624 case NGX_QUIC_FT_CONNECTION_CLOSE:
625 case NGX_QUIC_FT_CONNECTION_CLOSE2:
625 626
626 p = ngx_quic_parse_int_multi(p, end, &f->u.close.error_code, 627 p = ngx_quic_parse_int_multi(p, end, &f->u.close.error_code,
627 &f->u.close.frame_type, 628 &f->u.close.frame_type,
628 &f->u.close.reason.len, NULL); 629 &f->u.close.reason.len, NULL);
629 if (p == NULL) { 630 if (p == NULL) {
638 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, 639 ngx_log_error(NGX_LOG_ERR, pkt->log, 0,
639 "failed to parse close reason"); 640 "failed to parse close reason");
640 return NGX_ERROR; 641 return NGX_ERROR;
641 } 642 }
642 643
643 if (f->u.close.error_code >= NGX_QUIC_ERR_LAST) { 644 if (f->type == NGX_QUIC_FT_CONNECTION_CLOSE) {
644 ngx_log_error(NGX_LOG_ERR, pkt->log, 0, 645
645 "unkown error code: %ui, truncated", 646 if (f->u.close.error_code >= NGX_QUIC_ERR_LAST) {
646 f->u.close.error_code); 647 ngx_log_error(NGX_LOG_ERR, pkt->log, 0,
647 f->u.close.error_code = NGX_QUIC_ERR_LAST - 1; 648 "unkown error code: %ui, truncated",
648 } 649 f->u.close.error_code);
649 650 f->u.close.error_code = NGX_QUIC_ERR_LAST - 1;
650 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, pkt->log, 0, 651 }
651 "CONN.CLOSE: { %s (0x%xi) type=0x%xi reason='%V'}", 652
652 ngx_quic_error_text(f->u.close.error_code), 653 ngx_log_debug4(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
653 f->u.close.error_code, f->u.close.frame_type, 654 "CONN.CLOSE: { %s (0x%xi) type=0x%xi reason='%V'}",
654 &f->u.close.reason); 655 ngx_quic_error_text(f->u.close.error_code),
656 f->u.close.error_code, f->u.close.frame_type,
657 &f->u.close.reason);
658 } else {
659
660 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, pkt->log, 0,
661 "CONN.CLOSE2: { (0x%xi) type=0x%xi reason '%V'}",
662 f->u.close.error_code, f->u.close.frame_type,
663 &f->u.close.reason);
664 }
655 665
656 break; 666 break;
657 667
658 case NGX_QUIC_FT_STREAM0: 668 case NGX_QUIC_FT_STREAM0:
659 case NGX_QUIC_FT_STREAM1: 669 case NGX_QUIC_FT_STREAM1: