diff --git a/compio-driver/Cargo.toml b/compio-driver/Cargo.toml index 2bcfd25b..4e436d16 100644 --- a/compio-driver/Cargo.toml +++ b/compio-driver/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "compio-driver" -version = "0.5.0" +version = "0.5.1" description = "Low-level driver for compio" categories = ["asynchronous"] keywords = ["async", "iocp", "io-uring"] diff --git a/compio-driver/src/iour/mod.rs b/compio-driver/src/iour/mod.rs index 396d5bfc..92d56972 100644 --- a/compio-driver/src/iour/mod.rs +++ b/compio-driver/src/iour/mod.rs @@ -308,7 +308,7 @@ fn timespec(duration: std::time::Duration) -> Timespec { #[derive(Debug)] struct Notifier { - fd: OwnedFd, + fd: Arc, } impl Notifier { @@ -316,7 +316,7 @@ impl Notifier { fn new() -> io::Result { let fd = syscall!(libc::eventfd(0, libc::EFD_CLOEXEC | libc::EFD_NONBLOCK))?; let fd = unsafe { OwnedFd::from_raw_fd(fd) }; - Ok(Self { fd }) + Ok(Self { fd: Arc::new(fd) }) } pub fn clear(&self) -> io::Result<()> { @@ -342,7 +342,7 @@ impl Notifier { } pub fn handle(&self) -> io::Result { - Ok(NotifyHandle::new(self.fd.try_clone()?)) + Ok(NotifyHandle::new(self.fd.clone())) } } @@ -354,11 +354,11 @@ impl AsRawFd for Notifier { /// A notify handle to the inner driver. pub struct NotifyHandle { - fd: OwnedFd, + fd: Arc, } impl NotifyHandle { - pub(crate) fn new(fd: OwnedFd) -> Self { + pub(crate) fn new(fd: Arc) -> Self { Self { fd } } diff --git a/compio-driver/src/poll/mod.rs b/compio-driver/src/poll/mod.rs index b6e05e1f..da16010a 100644 --- a/compio-driver/src/poll/mod.rs +++ b/compio-driver/src/poll/mod.rs @@ -326,7 +326,7 @@ fn entry_cancelled(user_data: usize) -> Entry { struct Notifier { notify_reader: os_pipe::PipeReader, - notify_writer: os_pipe::PipeWriter, + notify_writer: Arc, } impl Notifier { @@ -343,12 +343,12 @@ impl Notifier { Ok(Self { notify_reader, - notify_writer, + notify_writer: Arc::new(notify_writer), }) } pub fn handle(&self) -> io::Result { - Ok(NotifyHandle::new(self.notify_writer.try_clone()?)) + Ok(NotifyHandle::new(self.notify_writer.clone())) } pub fn clear(&self) -> io::Result<()> { @@ -367,16 +367,16 @@ impl Notifier { /// A notify handle to the inner driver. pub struct NotifyHandle { - sender: os_pipe::PipeWriter, + sender: Arc, } impl NotifyHandle { - fn new(sender: os_pipe::PipeWriter) -> Self { + fn new(sender: Arc) -> Self { Self { sender } } /// Notify the inner driver. pub fn notify(&self) -> io::Result<()> { - (&self.sender).write_all(&[1u8]) + (&*self.sender).write_all(&[1u8]) } } diff --git a/compio-net/src/cmsg/mod.rs b/compio-net/src/cmsg/mod.rs index 8614fde0..bc61dfc6 100644 --- a/compio-net/src/cmsg/mod.rs +++ b/compio-net/src/cmsg/mod.rs @@ -13,7 +13,7 @@ cfg_if::cfg_if! { /// Reference to a control message. pub struct CMsgRef<'a>(sys::CMsgRef<'a>); -impl<'a> CMsgRef<'a> { +impl CMsgRef<'_> { /// Returns the level of the control message. pub fn level(&self) -> i32 { self.0.level() diff --git a/compio-net/src/cmsg/unix.rs b/compio-net/src/cmsg/unix.rs index 4f44547c..81f25122 100644 --- a/compio-net/src/cmsg/unix.rs +++ b/compio-net/src/cmsg/unix.rs @@ -2,7 +2,7 @@ use libc::{CMSG_DATA, CMSG_FIRSTHDR, CMSG_LEN, CMSG_NXTHDR, CMSG_SPACE, c_int, c pub(crate) struct CMsgRef<'a>(&'a cmsghdr); -impl<'a> CMsgRef<'a> { +impl CMsgRef<'_> { pub(crate) fn level(&self) -> c_int { self.0.cmsg_level } @@ -23,7 +23,7 @@ impl<'a> CMsgRef<'a> { pub(crate) struct CMsgMut<'a>(&'a mut cmsghdr); -impl<'a> CMsgMut<'a> { +impl CMsgMut<'_> { pub(crate) fn set_level(&mut self, level: c_int) { self.0.cmsg_level = level; } diff --git a/compio-net/src/cmsg/windows.rs b/compio-net/src/cmsg/windows.rs index 7efd452b..3c6beaad 100644 --- a/compio-net/src/cmsg/windows.rs +++ b/compio-net/src/cmsg/windows.rs @@ -55,7 +55,7 @@ const fn wsa_cmsg_len(length: usize) -> usize { pub struct CMsgRef<'a>(&'a CMSGHDR); -impl<'a> CMsgRef<'a> { +impl CMsgRef<'_> { pub fn level(&self) -> i32 { self.0.cmsg_level } @@ -76,7 +76,7 @@ impl<'a> CMsgRef<'a> { pub(crate) struct CMsgMut<'a>(&'a mut CMSGHDR); -impl<'a> CMsgMut<'a> { +impl CMsgMut<'_> { pub(crate) fn set_level(&mut self, level: i32) { self.0.cmsg_level = level; } diff --git a/compio-tls/tests/connect.rs b/compio-tls/tests/connect.rs index e592a9de..58a21d13 100644 --- a/compio-tls/tests/connect.rs +++ b/compio-tls/tests/connect.rs @@ -1,5 +1,3 @@ -use std::sync::Arc; - use compio_io::{AsyncReadExt, AsyncWrite, AsyncWriteExt}; use compio_net::TcpStream; use compio_tls::TlsConnector; @@ -33,7 +31,7 @@ async fn rtls() { store.add(cert).unwrap(); } - let connector = TlsConnector::from(Arc::new( + let connector = TlsConnector::from(std::sync::Arc::new( rustls::ClientConfig::builder() .with_root_certificates(store) .with_no_client_auth(),