mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-24 12:13:05 +00:00
proto: fix NewConnectionId size bound
This commit is contained in:
committed by
Benjamin Saunders
parent
1f8d2c26b7
commit
446cd72e38
@@ -28,7 +28,7 @@ use crate::{
|
||||
coding::BufMutExt,
|
||||
config::{ServerConfig, TransportConfig},
|
||||
crypto::{self, KeyPair, Keys, PacketKey},
|
||||
frame::{self, Close, Datagram, FrameStruct, NewToken},
|
||||
frame::{self, Close, Datagram, FrameStruct, NewConnectionId, NewToken},
|
||||
packet::{
|
||||
FixedLengthConnectionIdParser, Header, InitialHeader, InitialPacket, LongType, Packet,
|
||||
PacketNumber, PartialDecode, SpaceId,
|
||||
@@ -3334,7 +3334,7 @@ impl Connection {
|
||||
}
|
||||
|
||||
// NEW_CONNECTION_ID
|
||||
while buf.len() + 44 < max_size {
|
||||
while buf.len() + NewConnectionId::SIZE_BOUND < max_size {
|
||||
let issued = match space.pending.new_cids.pop() {
|
||||
Some(x) => x,
|
||||
None => break,
|
||||
|
||||
@@ -884,6 +884,10 @@ impl NewConnectionId {
|
||||
}
|
||||
}
|
||||
|
||||
impl FrameStruct for NewConnectionId {
|
||||
const SIZE_BOUND: usize = 1 + 8 + 8 + 1 + MAX_CID_SIZE + RESET_TOKEN_SIZE;
|
||||
}
|
||||
|
||||
/// Smallest number of bytes this type of frame is guaranteed to fit within.
|
||||
pub(crate) const RETIRE_CONNECTION_ID_SIZE_BOUND: usize = 9;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user