Mercurial > hg > nginx
diff src/event/quic/ngx_event_quic.c @ 8737:76f476ce4d31 quic
QUIC: distinct files for connection migration.
The connection migration-related code from quic.c with dependencies is moved
into separate file.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Wed, 31 Mar 2021 14:57:15 +0300 |
parents | 714e9af983de |
children | fa24745b8c06 |
line wrap: on
line diff
--- a/src/event/quic/ngx_event_quic.c +++ b/src/event/quic/ngx_event_quic.c @@ -10,21 +10,10 @@ #include <ngx_event_quic_transport.h> #include <ngx_event_quic_protection.h> #include <ngx_event_quic_connection.h> +#include <ngx_event_quic_migration.h> #include <ngx_sha1.h> -/* 0-RTT and 1-RTT data exist in the same packet number space, - * so we have 3 packet number spaces: - * - * 0 - Initial - * 1 - Handshake - * 2 - 0-RTT and 1-RTT - */ -#define ngx_quic_get_send_ctx(qc, level) \ - ((level) == ssl_encryption_initial) ? &((qc)->send_ctx[0]) \ - : (((level) == ssl_encryption_handshake) ? &((qc)->send_ctx[1]) \ - : &((qc)->send_ctx[2])) - #define ngx_quic_lost_threshold(qc) \ ngx_max(NGX_QUIC_TIME_THR * ngx_max((qc)->latest_rtt, (qc)->avg_rtt), \ NGX_QUIC_TIME_GRANULARITY) @@ -141,8 +130,6 @@ static ngx_int_t ngx_quic_handle_ack_fra ngx_msec_t *send_time); static void ngx_quic_rtt_sample(ngx_connection_t *c, ngx_quic_ack_frame_t *ack, enum ssl_encryption_level_t level, ngx_msec_t send_time); -static ngx_inline ngx_msec_t ngx_quic_pto(ngx_connection_t *c, - ngx_quic_send_ctx_t *ctx); static void ngx_quic_handle_stream_ack(ngx_connection_t *c, ngx_quic_frame_t *f); @@ -177,8 +164,6 @@ static ngx_int_t ngx_quic_handle_stop_se ngx_quic_header_t *pkt, ngx_quic_stop_sending_frame_t *f); static ngx_int_t ngx_quic_handle_max_streams_frame(ngx_connection_t *c, ngx_quic_header_t *pkt, ngx_quic_max_streams_frame_t *f); -static ngx_int_t ngx_quic_handle_path_challenge_frame(ngx_connection_t *c, - ngx_quic_header_t *pkt, ngx_quic_path_challenge_frame_t *f); static ngx_int_t ngx_quic_handle_new_connection_id_frame(ngx_connection_t *c, ngx_quic_header_t *pkt, ngx_quic_new_conn_id_frame_t *f); static ngx_int_t ngx_quic_retire_connection_id(ngx_connection_t *c, @@ -2755,6 +2740,17 @@ ngx_quic_handle_frames(ngx_connection_t break; + case NGX_QUIC_FT_PATH_RESPONSE: + + if (ngx_quic_handle_path_response_frame(c, pkt, + &frame.u.path_response) + != NGX_OK) + { + return NGX_ERROR; + } + + break; + case NGX_QUIC_FT_NEW_CONNECTION_ID: if (ngx_quic_handle_new_connection_id_frame(c, pkt, &frame.u.ncid) @@ -2776,13 +2772,6 @@ ngx_quic_handle_frames(ngx_connection_t break; - case NGX_QUIC_FT_PATH_RESPONSE: - - /* TODO: handle */ - ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, - "quic frame handler not implemented"); - break; - default: ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "quic missing frame handler"); @@ -3510,7 +3499,7 @@ ngx_quic_rtt_sample(ngx_connection_t *c, } -static ngx_inline ngx_msec_t +ngx_msec_t ngx_quic_pto(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx) { ngx_msec_t duration; @@ -4378,30 +4367,6 @@ ngx_quic_handle_max_streams_frame(ngx_co static ngx_int_t -ngx_quic_handle_path_challenge_frame(ngx_connection_t *c, - ngx_quic_header_t *pkt, ngx_quic_path_challenge_frame_t *f) -{ - ngx_quic_frame_t *frame; - ngx_quic_connection_t *qc; - - qc = ngx_quic_get_connection(c); - - frame = ngx_quic_alloc_frame(c); - if (frame == NULL) { - return NGX_ERROR; - } - - frame->level = pkt->level; - frame->type = NGX_QUIC_FT_PATH_RESPONSE; - frame->u.path_response = *f; - - ngx_quic_queue_frame(qc, frame); - - return NGX_OK; -} - - -static ngx_int_t ngx_quic_handle_new_connection_id_frame(ngx_connection_t *c, ngx_quic_header_t *pkt, ngx_quic_new_conn_id_frame_t *f) {