dotpcap / sharppcap

Official repository - Fully managed, cross platform (Windows, Mac, Linux) .NET library for capturing packets
1.28k stars 267 forks source link

make the capture thread thread safe #422

Closed sensokame closed 1 year ago

sensokame commented 1 year ago

segmentation fault crash raised on linux systems when multiple threads are trying to handle the same devices. This pull requests "locks" the release handle until the capture thread exits.

sensokame commented 1 year ago

@kayoub5 can you check this branch?

codecov-commenter commented 1 year ago

Codecov Report

Merging #422 (904547c) into master (cad73d6) will decrease coverage by 0.25%. The diff coverage is 79.48%.

@@            Coverage Diff             @@
##           master     #422      +/-   ##
==========================================
- Coverage   83.22%   82.97%   -0.26%     
==========================================
  Files          51       51              
  Lines        2802     2854      +52     
  Branches      309      318       +9     
==========================================
+ Hits         2332     2368      +36     
- Misses        349      361      +12     
- Partials      121      125       +4     
Impacted Files Coverage Δ
SharpPcap/LibPcap/PcapDeviceCaptureLoop.cs 87.75% <79.48%> (-5.11%) :arrow_down:
SharpPcap/LibPcap/PcapDevice.cs 75.12% <0.00%> (-2.49%) :arrow_down:
SharpPcap/LibPcap/PcapHeader.cs 97.61% <0.00%> (-1.20%) :arrow_down:
SharpPcap/WinDivert/WinDivertDevice.cs 72.87% <0.00%> (-0.81%) :arrow_down:
SharpPcap/LibPcap/CaptureFileWriterDevice.cs 84.74% <0.00%> (+4.74%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more