Skip to content

Commit f896836

Browse files
committed
Rename Handle to PcapHandle
1 parent 20da2c1 commit f896836

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/capture/activated/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::{
1919
use std::os::unix::io::RawFd;
2020

2121
use crate::{
22-
capture::{Activated, Capture, Handle},
22+
capture::{Activated, Capture, PcapHandle},
2323
codec::PacketCodec,
2424
linktype::Linktype,
2525
packet::{Packet, PacketHeader},
@@ -264,7 +264,7 @@ impl<T: Activated + ?Sized> Capture<T> {
264264
/// ```
265265
pub fn breakloop_handle(&mut self) -> BreakLoop {
266266
BreakLoop {
267-
handle: Arc::<Handle>::downgrade(&self.handle),
267+
handle: Arc::<PcapHandle>::downgrade(&self.handle),
268268
}
269269
}
270270

@@ -317,7 +317,7 @@ impl<T: Activated + ?Sized> Capture<T> {
317317
struct HandlerFn<F> {
318318
func: F,
319319
panic_payload: Option<Box<dyn Any + Send>>,
320-
handle: Arc<Handle>,
320+
handle: Arc<PcapHandle>,
321321
}
322322

323323
impl<F> HandlerFn<F>
@@ -361,7 +361,7 @@ impl<T: Activated> From<Capture<T>> for Capture<dyn Activated> {
361361
/// See <https://www.tcpdump.org/manpages/pcap_breakloop.3pcap.html> for per-platform caveats about
362362
/// how breakloop can wake up blocked threads.
363363
pub struct BreakLoop {
364-
handle: Weak<Handle>,
364+
handle: Weak<PcapHandle>,
365365
}
366366

367367
unsafe impl Send for BreakLoop {}

src/capture/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ impl State for Dead {}
9191
/// ```
9292
pub struct Capture<T: State + ?Sized> {
9393
nonblock: bool,
94-
handle: Arc<Handle>,
94+
handle: Arc<PcapHandle>,
9595
_marker: PhantomData<T>,
9696
}
9797

98-
struct Handle {
98+
struct PcapHandle {
9999
handle: NonNull<raw::pcap_t>,
100100
}
101101

102-
impl Handle {
102+
impl PcapHandle {
103103
fn as_ptr(&self) -> *mut raw::pcap_t {
104104
self.handle.as_ptr()
105105
}
@@ -108,9 +108,9 @@ impl Handle {
108108
// `PcapHandle` is safe to Send as it encapsulates the entire lifetime of `raw::pcap_t *`, but it is
109109
// not safe to Sync as libpcap does not promise thread-safe access to the same `raw::pcap_t *` from
110110
// multiple threads.
111-
unsafe impl Send for Handle {}
111+
unsafe impl Send for PcapHandle {}
112112

113-
impl Drop for Handle {
113+
impl Drop for PcapHandle {
114114
fn drop(&mut self) {
115115
unsafe { raw::pcap_close(self.handle.as_ptr()) }
116116
}
@@ -122,7 +122,7 @@ impl<T: State + ?Sized> From<NonNull<raw::pcap_t>> for Capture<T> {
122122
fn from(handle: NonNull<raw::pcap_t>) -> Self {
123123
Capture {
124124
nonblock: false,
125-
handle: Arc::new(Handle { handle }),
125+
handle: Arc::new(PcapHandle { handle }),
126126
_marker: PhantomData,
127127
}
128128
}

0 commit comments

Comments
 (0)