comparison src/event/ngx_event_quic.c @ 8370:262396242352 quic

Reworked macros for parsing/assembling packet types. Previously, macros checking a packet type with the long header also checked whether this is a long header. Now it requires a separate preceding check.
author Vladimir Homutov <vl@nginx.com>
date Thu, 30 Apr 2020 12:38:38 +0300
parents bddf704d62c1
children 9d9531431c8c
comparison
equal deleted inserted replaced
8369:bddf704d62c1 8370:262396242352
2653 2653
2654 keys = &c->quic->keys[start->level]; 2654 keys = &c->quic->keys[start->level];
2655 2655
2656 pkt.secret = &keys->server; 2656 pkt.secret = &keys->server;
2657 2657
2658 pkt.flags = NGX_QUIC_PKT_FIXED_BIT;
2659
2658 if (start->level == ssl_encryption_initial) { 2660 if (start->level == ssl_encryption_initial) {
2659 pkt.flags = NGX_QUIC_PKT_INITIAL; 2661 pkt.flags |= NGX_QUIC_PKT_LONG | NGX_QUIC_PKT_INITIAL;
2660 pkt.token = initial_token; 2662 pkt.token = initial_token;
2661 2663
2662 } else if (start->level == ssl_encryption_handshake) { 2664 } else if (start->level == ssl_encryption_handshake) {
2663 pkt.flags = NGX_QUIC_PKT_HANDSHAKE; 2665 pkt.flags |= NGX_QUIC_PKT_LONG | NGX_QUIC_PKT_HANDSHAKE;
2664 2666
2665 } else { 2667 } else {
2666 // TODO: macro, set FIXED bit 2668 if (c->quic->key_phase) {
2667 pkt.flags = 0x40 | (c->quic->key_phase ? NGX_QUIC_PKT_KPHASE : 0); 2669 pkt.flags |= NGX_QUIC_PKT_KPHASE;
2670 }
2668 } 2671 }
2669 2672
2670 ngx_quic_set_packet_number(&pkt, ctx); 2673 ngx_quic_set_packet_number(&pkt, ctx);
2671 2674
2672 pkt.log = c->log; 2675 pkt.log = c->log;