Skip to content

Commit

Permalink
Packets might be just the right size (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby authored and apanda committed Dec 4, 2017
1 parent f69c26b commit 0c7ae4d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions framework/src/interface/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ impl<T: EndOffset, M: Sized + Send> Packet<T, M> {
#[inline]
pub fn parse_header<T2: EndOffset<PreviousHeader = T>>(mut self) -> Packet<T2, M> {
unsafe {
assert!{self.payload_size() > T2::size()}
assert!{self.payload_size() >= T2::size()}
let hdr = self.payload() as *mut T2;
let offset = self.offset() + self.payload_offset();
create_packet(self.get_mbuf_ref(), hdr, offset)
Expand All @@ -406,7 +406,7 @@ impl<T: EndOffset, M: Sized + Send> Packet<T, M> {
#[inline]
pub fn parse_header_and_record<T2: EndOffset<PreviousHeader = T>>(mut self) -> Packet<T2, M> {
unsafe {
assert!{self.payload_size() > T2::size()}
assert!{self.payload_size() >= T2::size()}
let hdr = self.payload() as *mut T2;
let payload_offset = self.payload_offset();
let offset = self.offset() + payload_offset;
Expand Down

0 comments on commit 0c7ae4d

Please sign in to comment.