On Thu, Jan 27, 2022 at 04:33:08AM +0000, Gao,Yan(媒体云) wrote: > > The main quic connection is created in ngx_quic_new_connection(), which > > calls ngx_quic_open_sockets() and it sets c->udp for the first time. > > > When packet arrives, c->udp is updated by ngx_lookup_udp_connection(). > > > The main connection does not have c->quic set; this is used in stream > > connections. To access main connection from quic stream, c->quic->parent > > may be used. > > ngx_event_recvmsg->(ls->handler) ngx_http_init_connection->ngx_http_v3_init: > if (c->quic == NULL) { > h3scf->quic.timeout = clcf->keepalive_timeout; > ngx_quic_run(c, &h3scf->quic); > return; > } > > And, why check c->quic == NULL, as it is never set
first time you get there with main nginx connection, when a first QUIC packet arrives. Thus test c->quic. and if it is NULL it means we need to create main quic connection and proceed with the handshake. When the handshake is complete, a stream will be created, and the ngx_quic_init_stream_handler() will be called which will invoke listening handler, and we will return into ngx_http_v3_init() with stream connection that has c->quic set and follow the other path. _______________________________________________ nginx-devel mailing list -- nginx-devel@nginx.org To unsubscribe send an email to nginx-devel-le...@nginx.org