comparison src/event/quic/ngx_event_quic_output.c @ 9000:cd8018bc81a5 quic

QUIC: fixed padding of initial packets in case of limited path. Previously, non-padded initial packet could be sent as a result of the following situation: - initial queue is not empty (so padding to 1200 is required) - handshake queue is not empty (so padding is to be added after h/s packet) - path is limited If serializing handshake packet would violate path limit, such packet was omitted, and the non-padded initial packet was sent. The fix is to avoid sending the packet at all in such case. This follows the original intention introduced in c5155a0cb12f.
author Vladimir Homutov <vl@nginx.com>
date Wed, 02 Feb 2022 14:16:48 +0300
parents e00295b76395
children 868e1b76c956
comparison
equal deleted inserted replaced
8999:92729be0377b 9000:cd8018bc81a5
156 156
157 min = (i == pad && p - dst < NGX_QUIC_MIN_INITIAL_SIZE) 157 min = (i == pad && p - dst < NGX_QUIC_MIN_INITIAL_SIZE)
158 ? NGX_QUIC_MIN_INITIAL_SIZE - (p - dst) : 0; 158 ? NGX_QUIC_MIN_INITIAL_SIZE - (p - dst) : 0;
159 159
160 if (min > len) { 160 if (min > len) {
161 continue; 161 /* padding can't be applied - avoid sending the packet */
162
163 for (i = 0; i < NGX_QUIC_SEND_CTX_LAST; i++) {
164 ctx = &qc->send_ctx[i];
165 ngx_quic_revert_send(c, ctx, preserved_pnum[i]);
166 }
167
168 return NGX_OK;
162 } 169 }
163 170
164 n = ngx_quic_output_packet(c, ctx, p, len, min); 171 n = ngx_quic_output_packet(c, ctx, p, len, min);
165 if (n == NGX_ERROR) { 172 if (n == NGX_ERROR) {
166 return NGX_ERROR; 173 return NGX_ERROR;