chore: upgrade async-io to v2.4.1 (#3911)

* chore: upgrade async-io to v2.4

* refactor: replace `get_mut()` with `get_ref()` in Socket impls

---------

Co-authored-by: zebrapurring <>
This commit is contained in:
zebrapurring
2025-07-05 04:10:03 +02:00
committed by GitHub
parent 97de03482c
commit e627673869
3 changed files with 33 additions and 155 deletions

View File

@@ -62,7 +62,7 @@ ipnetwork = { workspace = true, optional = true }
mac_address = { workspace = true, optional = true }
uuid = { workspace = true, optional = true }
async-io = { version = "1.9.0", optional = true }
async-io = { version = "2.4.1", optional = true }
base64 = { version = "0.22.0", default-features = false, features = ["std"] }
bytes = "1.1.0"
chrono = { version = "0.4.34", default-features = false, features = ["clock"], optional = true }

View File

@@ -11,11 +11,11 @@ use async_io::Async;
impl Socket for Async<TcpStream> {
fn try_read(&mut self, buf: &mut dyn ReadBuf) -> io::Result<usize> {
self.get_mut().read(buf.init_mut())
self.get_ref().read(buf.init_mut())
}
fn try_write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.get_mut().write(buf)
self.get_ref().write(buf)
}
fn poll_read_ready(&mut self, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
@@ -27,18 +27,18 @@ impl Socket for Async<TcpStream> {
}
fn poll_shutdown(&mut self, _cx: &mut Context<'_>) -> Poll<io::Result<()>> {
Poll::Ready(self.get_mut().shutdown(Shutdown::Both))
Poll::Ready(self.get_ref().shutdown(Shutdown::Both))
}
}
#[cfg(unix)]
impl Socket for Async<std::os::unix::net::UnixStream> {
fn try_read(&mut self, buf: &mut dyn ReadBuf) -> io::Result<usize> {
self.get_mut().read(buf.init_mut())
self.get_ref().read(buf.init_mut())
}
fn try_write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.get_mut().write(buf)
self.get_ref().write(buf)
}
fn poll_read_ready(&mut self, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
@@ -50,6 +50,6 @@ impl Socket for Async<std::os::unix::net::UnixStream> {
}
fn poll_shutdown(&mut self, _cx: &mut Context<'_>) -> Poll<io::Result<()>> {
Poll::Ready(self.get_mut().shutdown(Shutdown::Both))
Poll::Ready(self.get_ref().shutdown(Shutdown::Both))
}
}