Closed Stargateur closed 2 years ago
Merged this manually due to merge conflicts
FYI, I had to revert this change as it was causing segmentation faults (see #254). However, if there is non-segmentation faulting way to implement this, it would be very welcome.
I don't understand how that possible, I think this change reveal an UB somewhere else in the code.
The problem is the Drop implementation:
impl<T: State + ?Sized> Drop for Capture<T> {
fn drop(&mut self) {
unsafe { raw::pcap_close(self.handle.as_ptr()) }
}
}
We should encapsulate handle: NonNull<raw::pcap_t>,
into a type that have drop implement to avoid this trap it in future.
If you would like to submit a PR with it, it would be welcome
This simply remove 2 unnecessary transmute.