diff --git a/src/protocol.rs b/src/protocol.rs index 13f1845..c41be00 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -751,8 +751,8 @@ impl JulietProtocol { ) -> Outcome { // First, attempt to complete a frame. loop { - // We do not have enough data to extract a header, indicate and return. if buffer.len() < Header::SIZE { + // We do not have enough data to extract a header, indicate and return. return Outcome::incomplete(Header::SIZE - buffer.len()); } diff --git a/src/protocol/multiframe.rs b/src/protocol/multiframe.rs index a9c195e..61f51f6 100644 --- a/src/protocol/multiframe.rs +++ b/src/protocol/multiframe.rs @@ -212,7 +212,9 @@ impl InitialFrameData { /// Returns whether or not the initial frame data describes a complete initial frame. #[inline(always)] fn is_complete(self) -> bool { - self.segment_len >= self.payload_size as usize + debug_assert!(self.segment_len <= self.payload_size as usize); + + self.segment_len == self.payload_size as usize } }