comparison src/event/quic/ngx_event_quic_migration.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 28fc35b71d75
comparison
equal deleted inserted replaced
9016:55b38514729b 9017:c2f5d79cde64
262 qc = ngx_quic_get_connection(c); 262 qc = ngx_quic_get_connection(c);
263 qsock = ngx_quic_get_socket(c); 263 qsock = ngx_quic_get_socket(c);
264 264
265 len = pkt->raw->last - pkt->raw->start; 265 len = pkt->raw->last - pkt->raw->start;
266 266
267 if (c->udp->dgram == NULL) { 267 if (c->udp->buffer == NULL) {
268 /* first ever packet in connection, path already exists */ 268 /* first ever packet in connection, path already exists */
269 path = qc->path; 269 path = qc->path;
270 goto update; 270 goto update;
271 } 271 }
272 272
276 q != ngx_queue_sentinel(&qc->paths); 276 q != ngx_queue_sentinel(&qc->paths);
277 q = ngx_queue_next(q)) 277 q = ngx_queue_next(q))
278 { 278 {
279 path = ngx_queue_data(q, ngx_quic_path_t, queue); 279 path = ngx_queue_data(q, ngx_quic_path_t, queue);
280 280
281 if (ngx_cmp_sockaddr(c->udp->dgram->sockaddr, c->udp->dgram->socklen, 281 if (ngx_cmp_sockaddr(&qsock->sockaddr.sockaddr, qsock->socklen,
282 path->sockaddr, path->socklen, 1) 282 path->sockaddr, path->socklen, 1)
283 == NGX_OK) 283 == NGX_OK)
284 { 284 {
285 goto update; 285 goto update;
286 } 286 }
313 "quic no available client ids for new path"); 313 "quic no available client ids for new path");
314 /* stop processing of this datagram */ 314 /* stop processing of this datagram */
315 return NGX_DONE; 315 return NGX_DONE;
316 } 316 }
317 317
318 path = ngx_quic_new_path(c, c->udp->dgram->sockaddr, 318 path = ngx_quic_new_path(c, &qsock->sockaddr.sockaddr, qsock->socklen, cid);
319 c->udp->dgram->socklen, cid);
320 if (path == NULL) { 319 if (path == NULL) {
321 return NGX_ERROR; 320 return NGX_ERROR;
322 } 321 }
323 322
324 path->tag = NGX_QUIC_PATH_PROBE; 323 path->tag = NGX_QUIC_PATH_PROBE;