comparison src/event/quic/ngx_event_quic.c @ 9147:58afcd72446f

QUIC: path MTU discovery. MTU selection starts by doubling the initial MTU until the first failure. Then binary search is used to find the path MTU.
author Roman Arutyunyan <arut@nginx.com>
date Mon, 14 Aug 2023 09:21:27 +0400
parents bba136612fe4
children 2880f60a80c3
comparison
equal deleted inserted replaced
9146:f3412ec3b6d1 9147:58afcd72446f
147 qc->error_reason = "invalid maximum packet size"; 147 qc->error_reason = "invalid maximum packet size";
148 148
149 ngx_log_error(NGX_LOG_INFO, c->log, 0, 149 ngx_log_error(NGX_LOG_INFO, c->log, 0,
150 "quic maximum packet size is invalid"); 150 "quic maximum packet size is invalid");
151 return NGX_ERROR; 151 return NGX_ERROR;
152
153 } else if (ctp->max_udp_payload_size > ngx_quic_max_udp_payload(c)) {
154 ctp->max_udp_payload_size = ngx_quic_max_udp_payload(c);
155 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
156 "quic client maximum packet size truncated");
157 } 152 }
158 153
159 if (ctp->active_connection_id_limit < 2) { 154 if (ctp->active_connection_id_limit < 2) {
160 qc->error = NGX_QUIC_ERR_TRANSPORT_PARAMETER_ERROR; 155 qc->error = NGX_QUIC_ERR_TRANSPORT_PARAMETER_ERROR;
161 qc->error_reason = "invalid active_connection_id_limit"; 156 qc->error_reason = "invalid active_connection_id_limit";
284 qc->close.data = c; 279 qc->close.data = c;
285 qc->close.handler = ngx_quic_close_handler; 280 qc->close.handler = ngx_quic_close_handler;
286 281
287 qc->path_validation.log = c->log; 282 qc->path_validation.log = c->log;
288 qc->path_validation.data = c; 283 qc->path_validation.data = c;
289 qc->path_validation.handler = ngx_quic_path_validation_handler; 284 qc->path_validation.handler = ngx_quic_path_handler;
290 285
291 qc->conf = conf; 286 qc->conf = conf;
292 287
293 if (ngx_quic_init_transport_params(&qc->tp, conf) != NGX_OK) { 288 if (ngx_quic_init_transport_params(&qc->tp, conf) != NGX_OK) {
294 return NULL; 289 return NULL;
295 } 290 }
296 291
297 ctp = &qc->ctp; 292 ctp = &qc->ctp;
298 293
299 /* defaults to be used before actual client parameters are received */ 294 /* defaults to be used before actual client parameters are received */
300 ctp->max_udp_payload_size = ngx_quic_max_udp_payload(c); 295 ctp->max_udp_payload_size = NGX_QUIC_MAX_UDP_PAYLOAD_SIZE;
301 ctp->ack_delay_exponent = NGX_QUIC_DEFAULT_ACK_DELAY_EXPONENT; 296 ctp->ack_delay_exponent = NGX_QUIC_DEFAULT_ACK_DELAY_EXPONENT;
302 ctp->max_ack_delay = NGX_QUIC_DEFAULT_MAX_ACK_DELAY; 297 ctp->max_ack_delay = NGX_QUIC_DEFAULT_MAX_ACK_DELAY;
303 ctp->active_connection_id_limit = 2; 298 ctp->active_connection_id_limit = 2;
304 299
305 ngx_queue_init(&qc->streams.uninitialized); 300 ngx_queue_init(&qc->streams.uninitialized);