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

Rework of PfRingDevice capture thread implementation. #1668

Open
wants to merge 12 commits into
base: dev
Choose a base branch
from

Conversation

Dimi1010
Copy link
Collaborator

Fixes #1664.

  • Added StopToken and StopTokenSource that mirror C++20's stop_token and stop_source.
  • Reworked the capture thread function into a free function to simplify interactions.
    Many variables are now kept on the thread's stack instead of relying on member fields in PfRindDevice.
  • Extracted the code for setting core affinity into a function.
  • Cleaned up capture thread startup.

- Completely rewrote the capture thread function to be a free function.
- Added StopToken and StopTokenSource to encapsulate stop requests.
- Refactored startCaptureSingleThread to use startCaptureMultiThread.
@Dimi1010 Dimi1010 changed the title Rework of PF_RING capture thread implementation. Rework of PfRingDevice capture thread implementation. Dec 21, 2024
Copy link

codecov bot commented Dec 21, 2024

Codecov Report

Attention: Patch coverage is 0% with 19 lines in your changes missing coverage. Please review.

Project coverage is 83.12%. Comparing base (f81ced2) to head (ba9d32e).

Files with missing lines Patch % Lines
Pcap++/src/StopToken.cpp 0.00% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1668      +/-   ##
==========================================
- Coverage   83.16%   83.12%   -0.05%     
==========================================
  Files         277      278       +1     
  Lines       48193    48212      +19     
  Branches     9966     9947      -19     
==========================================
- Hits        40081    40077       -4     
- Misses       7234     7243       +9     
- Partials      878      892      +14     
Flag Coverage Δ
alpine320 75.11% <0.00%> (-0.04%) ⬇️
fedora40 75.16% <0.00%> (-0.04%) ⬇️
macos-13 80.62% <0.00%> (-0.04%) ⬇️
macos-14 80.62% <0.00%> (-0.04%) ⬇️
macos-15 80.59% <0.00%> (-0.04%) ⬇️
mingw32 70.81% <0.00%> (-0.11%) ⬇️
mingw64 70.79% <0.00%> (-0.09%) ⬇️
npcap 85.29% <ø> (-0.03%) ⬇️
rhel94 74.99% <0.00%> (-0.04%) ⬇️
ubuntu2004 58.58% <0.00%> (-0.03%) ⬇️
ubuntu2004-zstd 58.70% <0.00%> (-0.05%) ⬇️
ubuntu2204 74.93% <0.00%> (-0.05%) ⬇️
ubuntu2204-icpx 61.34% <0.00%> (-0.10%) ⬇️
ubuntu2404 75.19% <0.00%> (-0.01%) ⬇️
unittest 83.12% <0.00%> (-0.05%) ⬇️
windows-2019 85.33% <ø> (-0.01%) ⬇️
windows-2022 85.36% <ø> (-0.01%) ⬇️
winpcap 85.33% <ø> (ø)
xdp 50.50% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Dimi1010 Dimi1010 marked this pull request as ready for review December 24, 2024 14:37
@Dimi1010
Copy link
Collaborator Author

I don't actually have a system that can run PF_RING. So it would be nice if someone could test it live.

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.

PfRingDevice::startCaptureSingleThread maybe crash after exits the funtion
1 participant