From f8f534ac34aa3f6c3c10114222c7fc356e13f262 Mon Sep 17 00:00:00 2001 From: fakeshadow <24548779@qq.com> Date: Mon, 22 Mar 2021 00:23:49 +0800 Subject: [PATCH] remove override --- actix-rt/src/lib.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/actix-rt/src/lib.rs b/actix-rt/src/lib.rs index 4afa8ea0..950c30cb 100644 --- a/actix-rt/src/lib.rs +++ b/actix-rt/src/lib.rs @@ -73,12 +73,13 @@ pub mod net { //! TCP/UDP/Unix bindings (mostly Tokio re-exports). use std::{ + future::Future, io, task::{Context, Poll}, }; pub use tokio::io::Ready; - use tokio::io::{AsyncRead, AsyncWrite}; + use tokio::io::{AsyncRead, AsyncWrite, Interest}; pub use tokio::net::UdpSocket; pub use tokio::net::{TcpListener, TcpSocket, TcpStream}; @@ -100,22 +101,30 @@ pub mod net { impl ActixStream for TcpStream { fn poll_read_ready(&self, cx: &mut Context<'_>) -> Poll> { - TcpStream::poll_ready(self, cx) + let ready = self.ready(Interest::READABLE); + tokio::pin!(ready); + ready.poll(cx) } fn poll_write_ready(&self, cx: &mut Context<'_>) -> Poll> { - TcpStream::poll_ready(self, cx) + let ready = self.ready(Interest::WRITABLE); + tokio::pin!(ready); + ready.poll(cx) } } #[cfg(unix)] impl ActixStream for UnixStream { fn poll_read_ready(&self, cx: &mut Context<'_>) -> Poll> { - UnixStream::poll_ready(self, cx) + let ready = self.ready(Interest::READABLE); + self::pin!(ready); + ready.poll(cx) } fn poll_write_ready(&self, cx: &mut Context<'_>) -> Poll> { - UnixStream::poll_ready(self, cx) + let ready = self.ready(Interest::WRITABLE); + self::pin!(ready); + ready.poll(cx) } } }