diff options
author | Taiki Endo <te316e89@gmail.com> | 2020-10-06 02:22:19 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 10:22:19 -0700 |
commit | 561a71ad63e5e9fde7900c700596952372e4c5ac (patch) | |
tree | 453a0a076ef8f7183541a4d585cba0f93c911ceb | |
parent | 242ea011891099f348b755b2ea10ec9e9ea104db (diff) |
net: implement AsRawSocket on Windows (#2911)
-rw-r--r-- | tokio/src/net/tcp/listener.rs | 18 | ||||
-rw-r--r-- | tokio/src/net/tcp/stream.rs | 18 | ||||
-rw-r--r-- | tokio/src/net/udp/socket.rs | 18 |
3 files changed, 24 insertions, 30 deletions
diff --git a/tokio/src/net/tcp/listener.rs b/tokio/src/net/tcp/listener.rs index b8f61a63..0ac03632 100644 --- a/tokio/src/net/tcp/listener.rs +++ b/tokio/src/net/tcp/listener.rs @@ -431,14 +431,12 @@ mod sys { #[cfg(windows)] mod sys { - // TODO: let's land these upstream with mio and then we can add them here. - // - // use std::os::windows::prelude::*; - // use super::{TcpListener; - // - // impl AsRawHandle for TcpListener { - // fn as_raw_handle(&self) -> RawHandle { - // self.listener.io().as_raw_handle() - // } - // } + use super::TcpListener; + use std::os::windows::prelude::*; + + impl AsRawSocket for TcpListener { + fn as_raw_socket(&self) -> RawSocket { + self.io.get_ref().as_raw_socket() + } + } } diff --git a/tokio/src/net/tcp/stream.rs b/tokio/src/net/tcp/stream.rs index 50536e98..9141d981 100644 --- a/tokio/src/net/tcp/stream.rs +++ b/tokio/src/net/tcp/stream.rs @@ -596,14 +596,12 @@ mod sys { #[cfg(windows)] mod sys { - // TODO: let's land these upstream with mio and then we can add them here. - // - // use std::os::windows::prelude::*; - // use super::TcpStream; - // - // impl AsRawHandle for TcpStream { - // fn as_raw_handle(&self) -> RawHandle { - // self.io.get_ref().as_raw_handle() - // } - // } + use super::TcpStream; + use std::os::windows::prelude::*; + + impl AsRawSocket for TcpStream { + fn as_raw_socket(&self) -> RawSocket { + self.io.get_ref().as_raw_socket() + } + } } diff --git a/tokio/src/net/udp/socket.rs b/tokio/src/net/udp/socket.rs index 3a4c7c22..cc0291af 100644 --- a/tokio/src/net/udp/socket.rs +++ b/tokio/src/net/udp/socket.rs @@ -356,14 +356,12 @@ mod sys { #[cfg(windows)] mod sys { - // TODO: let's land these upstream with mio and then we can add them here. - // - // use std::os::windows::prelude::*; - // use super::UdpSocket; - // - // impl AsRawHandle for UdpSocket { - // fn as_raw_handle(&self) -> RawHandle { - // self.io.get_ref().as_raw_handle() - // } - // } + use super::UdpSocket; + use std::os::windows::prelude::*; + + impl AsRawSocket for UdpSocket { + fn as_raw_socket(&self) -> RawSocket { + self.io.get_ref().as_raw_socket() + } + } } |