Mercurial > hg > nginx
comparison src/event/quic/ngx_event_quic_migration.c @ 8944:b7284807b4fa quic
QUIC: refactored ngx_quic_validate_path().
The function now accepts path argument, as suggested by the name. Socket is
not really needed inside.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 16 Dec 2021 11:49:08 +0300 |
parents | 118a34e32121 |
children | 1e2f4e9c8195 |
comparison
equal
deleted
inserted
replaced
8943:118a34e32121 | 8944:b7284807b4fa |
---|---|
11 | 11 |
12 | 12 |
13 static void ngx_quic_set_connection_path(ngx_connection_t *c, | 13 static void ngx_quic_set_connection_path(ngx_connection_t *c, |
14 ngx_quic_path_t *path); | 14 ngx_quic_path_t *path); |
15 static ngx_int_t ngx_quic_validate_path(ngx_connection_t *c, | 15 static ngx_int_t ngx_quic_validate_path(ngx_connection_t *c, |
16 ngx_quic_socket_t *qsock); | 16 ngx_quic_path_t *path); |
17 static ngx_int_t ngx_quic_send_path_challenge(ngx_connection_t *c, | 17 static ngx_int_t ngx_quic_send_path_challenge(ngx_connection_t *c, |
18 ngx_quic_path_t *path); | 18 ngx_quic_path_t *path); |
19 static ngx_int_t ngx_quic_path_restore(ngx_connection_t *c); | 19 static ngx_int_t ngx_quic_path_restore(ngx_connection_t *c); |
20 static ngx_quic_path_t *ngx_quic_alloc_path(ngx_connection_t *c); | 20 static ngx_quic_path_t *ngx_quic_alloc_path(ngx_connection_t *c); |
21 | 21 |
420 ngx_quic_path_state_str(qc->socket->path), | 420 ngx_quic_path_state_str(qc->socket->path), |
421 qsock->sid.seqnum, qsock->cid->seqnum, next->seqnum, | 421 qsock->sid.seqnum, qsock->cid->seqnum, next->seqnum, |
422 ngx_quic_path_state_str(next)); | 422 ngx_quic_path_state_str(next)); |
423 | 423 |
424 if (next->state == NGX_QUIC_PATH_NEW) { | 424 if (next->state == NGX_QUIC_PATH_NEW) { |
425 if (ngx_quic_validate_path(c, qsock) != NGX_OK) { | 425 if (ngx_quic_validate_path(c, qsock->path) != NGX_OK) { |
426 return NGX_ERROR; | 426 return NGX_ERROR; |
427 } | 427 } |
428 } | 428 } |
429 | 429 |
430 ctx = ngx_quic_get_send_ctx(qc, pkt->level); | 430 ctx = ngx_quic_get_send_ctx(qc, pkt->level); |
476 return NGX_OK; | 476 return NGX_OK; |
477 } | 477 } |
478 | 478 |
479 | 479 |
480 static ngx_int_t | 480 static ngx_int_t |
481 ngx_quic_validate_path(ngx_connection_t *c, ngx_quic_socket_t *qsock) | 481 ngx_quic_validate_path(ngx_connection_t *c, ngx_quic_path_t *path) |
482 { | 482 { |
483 ngx_msec_t pto; | 483 ngx_msec_t pto; |
484 ngx_quic_path_t *path; | |
485 ngx_quic_send_ctx_t *ctx; | 484 ngx_quic_send_ctx_t *ctx; |
486 ngx_quic_connection_t *qc; | 485 ngx_quic_connection_t *qc; |
487 | 486 |
488 qc = ngx_quic_get_connection(c); | 487 qc = ngx_quic_get_connection(c); |
489 | |
490 path = qsock->path; | |
491 | 488 |
492 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, | 489 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, |
493 "quic initiated validation of new path #%uL", | 490 "quic initiated validation of new path #%uL", |
494 path->seqnum); | 491 path->seqnum); |
495 | 492 |