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

4 implement unblock stop logic for non ring source #10

Merged
merged 2 commits into from
Mar 18, 2023

Conversation

fako1024
Copy link
Owner

Turns out it's possible to use the PPOLL syscall without a ring buffer (i.e. without a mmap'ed memory area) as well by setting up the same event handling logic and executing the unix.Recvfrom only upon receiving the appropriate event on the socket. This is obviously not "optimal" (in the sense of performance) because unix.Recvfrom was already blocking / waiting for packets, but IMHO this is outweighed by the fact that the event file descriptor is the only way to reliably stop / unblock a blocked capture (needed for graceful stop and rotations in goProbe and maybe similar scenarios, and also to achieve feature parity with the ring buffer source).
Given that the "plain" source is probably not the go-to choice for high-throughput situations anyway I think it's a good bargain. Should also help setting up a shared mock socket in #7 (because both sources now use the same socket / event logic).

Closes #4

@fako1024 fako1024 added the enhancement New feature or request label Mar 17, 2023
@fako1024 fako1024 requested a review from els0r March 17, 2023 09:40
@fako1024 fako1024 self-assigned this Mar 17, 2023
@fako1024 fako1024 linked an issue Mar 17, 2023 that may be closed by this pull request
3 tasks
@fako1024 fako1024 merged commit 6e83fc0 into main Mar 18, 2023
@fako1024 fako1024 deleted the 4-implement-unblock-stop-logic-for-non-ring-source branch March 18, 2023 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Unblock() / Stop() logic for non-ring source
2 participants