Skip to content

Commit aa0a10d

Browse files
zzzdongchifflier
authored andcommitted
Fix Correct header detection in LegacyPcapReader
Replace `header_sent` flag with `consumed`. This fixes the pcap-info example to read asset/ntp.pcap file.
1 parent c2fd14b commit aa0a10d

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/pcap/reader.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ where
7272
reader: R,
7373
buffer: Buffer,
7474
consumed: usize,
75-
header_sent: bool,
7675
reader_exhausted: bool,
7776
parse: LegacyParseFn,
7877
}
@@ -119,7 +118,6 @@ where
119118
reader,
120119
buffer,
121120
consumed: 0,
122-
header_sent: false,
123121
reader_exhausted: false,
124122
parse,
125123
})
@@ -131,8 +129,7 @@ where
131129
R: Read,
132130
{
133131
fn next(&mut self) -> Result<(usize, PcapBlockOwned), PcapError<&'_ [u8]>> {
134-
if !self.header_sent {
135-
self.header_sent = true;
132+
if self.consumed == 0 {
136133
return Ok((
137134
self.header.size(),
138135
PcapBlockOwned::from(self.header.clone()),

0 commit comments

Comments
 (0)