comparison src/event/ngx_event_quic.h @ 8355:ad3a6f069498 quic

Added proper handling of connection close phases. There are following flags in quic connection: closing - true, when a connection close is initiated, for whatever reason draining - true, when a CC frame is received from peer The following state machine is used for closing: +------------------+ | I/HS/AD | +------------------+ | | | | | V | | immediate close initiated: | | reasons: close by top-level protocol, fatal error | | + sends CC (probably with app-level message) | | + starts close_timer: 3 * PTO (current probe timeout) | | | | | V | | +---------+ - Reply to input with CC (rate-limited) | | | CLOSING | - Close/Reset all streams | | +---------+ | | | | | V V | | receives CC | | | | idle | | timer | | | V | | +----------+ | - MUST NOT send anything (MAY send a single CC) | | DRAINING | | - if not already started, starts close_timer: 3 * PTO | +----------+ | - if not already done, close all streams | | | | | | | close_timer fires | | V V +------------------------+ | CLOSED | - clean up all the resources, drop connection +------------------------+ state completely The ngx_quic_close_connection() function gets an "rc" argument, that signals reason of connection closing: NGX_OK - initiated by application (i.e. http/3), follow state machine NGX_DONE - timedout (while idle or draining) NGX_ERROR - fatal error, destroy connection immediately The PTO calculations are not yet implemented, hardcoded value of 5s is used.
author Vladimir Homutov <vl@nginx.com>
date Thu, 23 Apr 2020 13:41:08 +0300
parents d73516830236
children 2f900ae486bc
comparison
equal deleted inserted replaced
8354:d11bc25fc4c3 8355:ad3a6f069498
20 /* 1 flags + 4 version + 2 x (1 + 20) s/dcid + 4 pn + 4 len + token len */ 20 /* 1 flags + 4 version + 2 x (1 + 20) s/dcid + 4 pn + 4 len + token len */
21 21
22 #define NGX_QUIC_DEFAULT_MAX_PACKET_SIZE 65527 22 #define NGX_QUIC_DEFAULT_MAX_PACKET_SIZE 65527
23 #define NGX_QUIC_DEFAULT_ACK_DELAY_EXPONENT 3 23 #define NGX_QUIC_DEFAULT_ACK_DELAY_EXPONENT 3
24 #define NGX_QUIC_DEFAULT_MAX_ACK_DELAY 25 24 #define NGX_QUIC_DEFAULT_MAX_ACK_DELAY 25
25
26 #define NGX_QUIC_HARDCODED_PTO 1000 /* 1s, TODO: collect */
27 #define NGX_QUIC_CC_MIN_INTERVAL 1000 /* 1s */
25 28
26 #define NGX_QUIC_MIN_INITIAL_SIZE 1200 29 #define NGX_QUIC_MIN_INITIAL_SIZE 1200
27 30
28 #define NGX_QUIC_STREAM_SERVER_INITIATED 0x01 31 #define NGX_QUIC_STREAM_SERVER_INITIATED 0x01
29 #define NGX_QUIC_STREAM_UNIDIRECTIONAL 0x02 32 #define NGX_QUIC_STREAM_UNIDIRECTIONAL 0x02