comparison src/event/quic/ngx_event_quic.c @ 9017:c2f5d79cde64 quic

QUIC: separate UDP framework for QUIC. Previously, QUIC used the existing UDP framework, which was created for UDP in Stream. However the way QUIC connections are created and looked up is different from the way UDP connections in Stream are created and looked up. Now these two implementations are decoupled.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 20 Apr 2022 16:01:17 +0400
parents a2fbae359828
children f2925c80401c
comparison
equal deleted inserted replaced
9016:55b38514729b 9017:c2f5d79cde64
428 } 428 }
429 429
430 return; 430 return;
431 } 431 }
432 432
433 b = c->udp->dgram->buffer; 433 b = c->udp->buffer;
434 434
435 rc = ngx_quic_handle_datagram(c, b, NULL); 435 rc = ngx_quic_handle_datagram(c, b, NULL);
436 436
437 if (rc == NGX_ERROR) { 437 if (rc == NGX_ERROR) {
438 ngx_quic_close_connection(c, NGX_ERROR); 438 ngx_quic_close_connection(c, NGX_ERROR);
756 static ngx_int_t 756 static ngx_int_t
757 ngx_quic_handle_packet(ngx_connection_t *c, ngx_quic_conf_t *conf, 757 ngx_quic_handle_packet(ngx_connection_t *c, ngx_quic_conf_t *conf,
758 ngx_quic_header_t *pkt) 758 ngx_quic_header_t *pkt)
759 { 759 {
760 ngx_int_t rc; 760 ngx_int_t rc;
761 ngx_quic_socket_t *qsock;
761 ngx_quic_connection_t *qc; 762 ngx_quic_connection_t *qc;
762 763
763 c->log->action = "parsing quic packet"; 764 c->log->action = "parsing quic packet";
764 765
765 rc = ngx_quic_parse_packet(pkt); 766 rc = ngx_quic_parse_packet(pkt);
807 "quic version mismatch: 0x%xD", pkt->version); 808 "quic version mismatch: 0x%xD", pkt->version);
808 return NGX_DECLINED; 809 return NGX_DECLINED;
809 } 810 }
810 811
811 if (pkt->first) { 812 if (pkt->first) {
812 if (ngx_cmp_sockaddr(c->udp->dgram->sockaddr, 813 qsock = ngx_quic_get_socket(c);
813 c->udp->dgram->socklen, 814
815 if (ngx_cmp_sockaddr(&qsock->sockaddr.sockaddr, qsock->socklen,
814 qc->path->sockaddr, qc->path->socklen, 1) 816 qc->path->sockaddr, qc->path->socklen, 1)
815 != NGX_OK) 817 != NGX_OK)
816 { 818 {
817 /* packet comes from unknown path, possibly migration */ 819 /* packet comes from unknown path, possibly migration */
818 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, 820 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,