rusticata / pcap-parser

PCAP/PCAPNG file format parser written in pure Rust. Fast, zero-copy, safe.
Other
104 stars 24 forks source link

Return EOF from PcapReader::next if last refill failed #4

Closed Mrmaxmeier closed 4 years ago

Mrmaxmeier commented 4 years ago

This fixes #3 in a backwards compatible way. I'm not sure if this is the way to go though.

A simpler fix would return Err(PcapParser::Eof) from the refill methods if the reader didn't return anything. This could break existing usages of the library though.

Let me know which approach you prefer and I'll update the PR :)

chifflier commented 4 years ago

Doh, I thought I had fixed this annoying bug.

For the moment, I prefer not to change: refill having nothing to read is not an error (arguably, it is also not an error in next ...) as long as you do not attempt to read it.

chifflier commented 4 years ago

I prefer the current solution, so I merged the PR. I'll continue running some tests before a new release, but I'd like to release this fix as soon as possible.

Thanks!