mirror of https://github.com/smol-rs/async-net
Merge pull request #16 from smol-rs/taiki-e/owned
Use Async::{readable_owned, writable_owned}
This commit is contained in:
commit
a5b175921b
|
@ -15,7 +15,7 @@ keywords = ["networking", "uds", "mio", "reactor", "std"]
|
|||
categories = ["asynchronous", "network-programming", "os"]
|
||||
|
||||
[dependencies]
|
||||
async-io = "1.5.0"
|
||||
async-io = "1.6.0"
|
||||
blocking = "1.0.0"
|
||||
fastrand = "1.3.5"
|
||||
futures-lite = "1.11.0"
|
||||
|
|
12
src/tcp.rs
12
src/tcp.rs
|
@ -303,8 +303,8 @@ impl fmt::Debug for Incoming<'_> {
|
|||
/// ```
|
||||
pub struct TcpStream {
|
||||
inner: Arc<Async<std::net::TcpStream>>,
|
||||
readable: Option<async_io::Readable>,
|
||||
writable: Option<async_io::Writable>,
|
||||
readable: Option<async_io::ReadableOwned<std::net::TcpStream>>,
|
||||
writable: Option<async_io::WritableOwned<std::net::TcpStream>>,
|
||||
}
|
||||
|
||||
impl UnwindSafe for TcpStream {}
|
||||
|
@ -599,7 +599,7 @@ impl AsyncRead for TcpStream {
|
|||
|
||||
// Initialize the future to wait for readiness.
|
||||
if self.readable.is_none() {
|
||||
self.readable = Some(self.inner.readable());
|
||||
self.readable = Some(self.inner.clone().readable_owned());
|
||||
}
|
||||
|
||||
// Poll the future for readiness.
|
||||
|
@ -630,7 +630,7 @@ impl AsyncWrite for TcpStream {
|
|||
|
||||
// Initialize the future to wait for readiness.
|
||||
if self.writable.is_none() {
|
||||
self.writable = Some(self.inner.writable());
|
||||
self.writable = Some(self.inner.clone().writable_owned());
|
||||
}
|
||||
|
||||
// Poll the future for readiness.
|
||||
|
@ -655,7 +655,7 @@ impl AsyncWrite for TcpStream {
|
|||
|
||||
// Initialize the future to wait for readiness.
|
||||
if self.writable.is_none() {
|
||||
self.writable = Some(self.inner.writable());
|
||||
self.writable = Some(self.inner.clone().writable_owned());
|
||||
}
|
||||
|
||||
// Poll the future for readiness.
|
||||
|
@ -688,7 +688,7 @@ impl AsyncWrite for TcpStream {
|
|||
|
||||
// Initialize the future to wait for readiness.
|
||||
if self.writable.is_none() {
|
||||
self.writable = Some(self.inner.writable());
|
||||
self.writable = Some(self.inner.clone().writable_owned());
|
||||
}
|
||||
|
||||
// Poll the future for readiness.
|
||||
|
|
10
src/unix.rs
10
src/unix.rs
|
@ -234,8 +234,8 @@ impl fmt::Debug for Incoming<'_> {
|
|||
/// ```
|
||||
pub struct UnixStream {
|
||||
inner: Arc<Async<std::os::unix::net::UnixStream>>,
|
||||
readable: Option<async_io::Readable>,
|
||||
writable: Option<async_io::Writable>,
|
||||
readable: Option<async_io::ReadableOwned<std::os::unix::net::UnixStream>>,
|
||||
writable: Option<async_io::WritableOwned<std::os::unix::net::UnixStream>>,
|
||||
}
|
||||
|
||||
impl UnwindSafe for UnixStream {}
|
||||
|
@ -396,7 +396,7 @@ impl AsyncRead for UnixStream {
|
|||
|
||||
// Initialize the future to wait for readiness.
|
||||
if self.readable.is_none() {
|
||||
self.readable = Some(self.inner.readable());
|
||||
self.readable = Some(self.inner.clone().readable_owned());
|
||||
}
|
||||
|
||||
// Poll the future for readiness.
|
||||
|
@ -427,7 +427,7 @@ impl AsyncWrite for UnixStream {
|
|||
|
||||
// Initialize the future to wait for readiness.
|
||||
if self.writable.is_none() {
|
||||
self.writable = Some(self.inner.writable());
|
||||
self.writable = Some(self.inner.clone().writable_owned());
|
||||
}
|
||||
|
||||
// Poll the future for readiness.
|
||||
|
@ -452,7 +452,7 @@ impl AsyncWrite for UnixStream {
|
|||
|
||||
// Initialize the future to wait for readiness.
|
||||
if self.writable.is_none() {
|
||||
self.writable = Some(self.inner.writable());
|
||||
self.writable = Some(self.inner.clone().writable_owned());
|
||||
}
|
||||
|
||||
// Poll the future for readiness.
|
||||
|
|
Loading…
Reference in New Issue