Mercurial > hg > nginx
comparison src/event/ngx_event_quic.c @ 8566:9588a2782c62 quic
QUIC: speeding up handshake completion.
As per quic-recovery draft, section-6.2.3: resend CRYPTO frames
when receiving an Initial packet containing duplicate CRYPTO data.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Thu, 01 Oct 2020 12:10:22 +0100 |
parents | 0e12c4aca3ab |
children | 4983357258d7 |
comparison
equal
deleted
inserted
replaced
8565:0e12c4aca3ab | 8566:9588a2782c62 |
---|---|
2659 | 2659 |
2660 if (ngx_quic_adjust_frame_offset(c, frame, fs->received) | 2660 if (ngx_quic_adjust_frame_offset(c, frame, fs->received) |
2661 == NGX_DONE) | 2661 == NGX_DONE) |
2662 { | 2662 { |
2663 /* old/duplicate data range */ | 2663 /* old/duplicate data range */ |
2664 return NGX_OK; | 2664 return handler == ngx_quic_crypto_input ? NGX_DECLINED : NGX_OK; |
2665 } | 2665 } |
2666 | 2666 |
2667 /* intersecting data range, frame modified */ | 2667 /* intersecting data range, frame modified */ |
2668 } | 2668 } |
2669 | 2669 |
2842 static ngx_int_t | 2842 static ngx_int_t |
2843 ngx_quic_handle_crypto_frame(ngx_connection_t *c, ngx_quic_header_t *pkt, | 2843 ngx_quic_handle_crypto_frame(ngx_connection_t *c, ngx_quic_header_t *pkt, |
2844 ngx_quic_frame_t *frame) | 2844 ngx_quic_frame_t *frame) |
2845 { | 2845 { |
2846 uint64_t last; | 2846 uint64_t last; |
2847 ngx_int_t rc; | |
2847 ngx_quic_connection_t *qc; | 2848 ngx_quic_connection_t *qc; |
2848 ngx_quic_crypto_frame_t *f; | 2849 ngx_quic_crypto_frame_t *f; |
2849 ngx_quic_frames_stream_t *fs; | 2850 ngx_quic_frames_stream_t *fs; |
2850 | 2851 |
2851 qc = c->quic; | 2852 qc = c->quic; |
2858 if (last > fs->received && last - fs->received > NGX_QUIC_MAX_BUFFERED) { | 2859 if (last > fs->received && last - fs->received > NGX_QUIC_MAX_BUFFERED) { |
2859 c->quic->error = NGX_QUIC_ERR_CRYPTO_BUFFER_EXCEEDED; | 2860 c->quic->error = NGX_QUIC_ERR_CRYPTO_BUFFER_EXCEEDED; |
2860 return NGX_ERROR; | 2861 return NGX_ERROR; |
2861 } | 2862 } |
2862 | 2863 |
2863 return ngx_quic_handle_ordered_frame(c, fs, frame, ngx_quic_crypto_input, | 2864 rc = ngx_quic_handle_ordered_frame(c, fs, frame, ngx_quic_crypto_input, |
2864 NULL); | 2865 NULL); |
2866 if (rc != NGX_DECLINED) { | |
2867 return rc; | |
2868 } | |
2869 | |
2870 /* speeding up handshake completion */ | |
2871 | |
2872 if (pkt->level == ssl_encryption_initial) { | |
2873 ngx_quic_resend_frames(c, ngx_quic_get_send_ctx(qc, pkt->level)); | |
2874 } | |
2875 | |
2876 return NGX_OK; | |
2865 } | 2877 } |
2866 | 2878 |
2867 | 2879 |
2868 static ngx_int_t | 2880 static ngx_int_t |
2869 ngx_quic_crypto_input(ngx_connection_t *c, ngx_quic_frame_t *frame, void *data) | 2881 ngx_quic_crypto_input(ngx_connection_t *c, ngx_quic_frame_t *frame, void *data) |