Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recognize and handle truncated capture files #129

Merged
merged 1 commit into from Jun 10, 2022

Conversation

godlygeek
Copy link
Contributor

Make the RecordWriter finish a capture file by writing a non-zero
trailer byte that the RecordReader will ignore. When the FileSource
reads a (non-compressed) capture file, have it ignore any trailing zero
bytes without returning them to the caller. If the caller attempts to
read into them, treat it as though EOF has been reached instead.

When a trailer byte is encountered by the reader, treat it as EOF,
rather than continuing to request bytes from the reader.

Signed-off-by: Matt Wozniski mwozniski@bloomberg.net

pablogsal
pablogsal previously approved these changes Jun 10, 2022
Copy link
Member

@pablogsal pablogsal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Great work. I just left a collection of nits and other stuff, but just feel free to land when you are happy, don't wait for me to check back in :)

Make the `RecordWriter` finish a capture file by writing a non-zero
trailer byte that the `RecordReader` will ignore. When the `FileSource`
reads a (non-compressed) capture file, have it ignore any trailing zero
bytes without returning them to the caller. If the caller attempts to
read into them, treat it as though EOF has been reached instead.

When a trailer byte is encountered by the reader, treat it as EOF,
rather than continuing to request bytes from the reader.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
@godlygeek godlygeek enabled auto-merge (rebase) June 10, 2022 23:20
@godlygeek godlygeek merged commit 9821c99 into bloomberg:main Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants