quic: move all_consuming check to callee

Will alow to have decode_frames accept one additional parameter
with past fragment data
pull/12631/head
Philippe Antoine 2 weeks ago committed by Victor Julien
parent 294a33a890
commit ee04d667b5

@ -541,7 +541,7 @@ impl Frame {
}
pub(crate) fn decode_frames(input: &[u8]) -> IResult<&[u8], Vec<Frame>, QuicError> {
let (rest, mut frames) = many0(complete(Frame::decode_frame))(input)?;
let (rest, mut frames) = all_consuming(many0(complete(Frame::decode_frame)))(input)?;
// reassemble crypto fragments : first find total size
let mut crypto_max_size = 0;

@ -17,7 +17,7 @@
use super::error::QuicError;
use super::frames::Frame;
use nom7::bytes::complete::take;
use nom7::combinator::{all_consuming, map};
use nom7::combinator::map;
use nom7::number::complete::{be_u24, be_u32, be_u8};
use nom7::IResult;
use std::convert::TryFrom;
@ -393,7 +393,7 @@ impl QuicHeader {
impl QuicData {
pub(crate) fn from_bytes(input: &[u8]) -> Result<QuicData, QuicError> {
let (_, frames) = all_consuming(Frame::decode_frames)(input)?;
let (_, frames) = Frame::decode_frames(input)?;
Ok(QuicData { frames })
}
}

Loading…
Cancel
Save