From 80aee0d53103bf685f29ee3af0e1c76dc551c34c Mon Sep 17 00:00:00 2001
From: tyranron <tyranron@gmail.com>
Date: Tue, 12 Nov 2019 19:53:26 +0200
Subject: [PATCH] Migrate 'actix-server-config' to std futures

- remove "uds" feature
- disable features by default
---
 actix-server-config/Cargo.toml | 20 +++++++++-----------
 actix-server-config/src/lib.rs | 26 ++++++++++++++++----------
 2 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/actix-server-config/Cargo.toml b/actix-server-config/Cargo.toml
index 58d0486d..caf201e7 100644
--- a/actix-server-config/Cargo.toml
+++ b/actix-server-config/Cargo.toml
@@ -14,10 +14,10 @@ name = "actix_server_config"
 path = "src/lib.rs"
 
 [package.metadata.docs.rs]
-features = ["ssl", "rust-tls", "uds"]
+features = ["ssl", "rust-tls"]
 
 [features]
-default = ["ssl", "rustls" ]
+default = []
 
 # openssl
 ssl = ["tokio-openssl"]
@@ -25,15 +25,13 @@ ssl = ["tokio-openssl"]
 # rustls
 rust-tls = ["rustls", "tokio-rustls"]
 
-# unix domain sockets
-# TODO: FIXME
-uds = [] # ["tokio-uds"]
-
 [dependencies]
-futures = { package = "futures-preview", version = "0.3.0-alpha.18" }
-tokio = "0.2.0-alpha.4"
+futures = "0.3.1"
+tokio = "0.2.0-alpha.6"
 
-tokio-openssl = { version="0.4.0-alpha.4", optional = true }
+# openssl
+tokio-openssl = { version = "0.4.0-alpha.6", optional = true }
+
+# rustls
 rustls = { version = "0.16.0", optional = true }
-tokio-rustls = { version = "0.12.0-alpha.2", optional = true }
-#tokio-uds = { version="0.3.0-alpha.1", optional = true }
+tokio-rustls = { version = "0.12.0-alpha.8", optional = true }
diff --git a/actix-server-config/src/lib.rs b/actix-server-config/src/lib.rs
index bc487b86..11dc4971 100644
--- a/actix-server-config/src/lib.rs
+++ b/actix-server-config/src/lib.rs
@@ -1,10 +1,12 @@
+//! Actix server config utils.
+
 use std::cell::Cell;
 use std::net::SocketAddr;
 use std::rc::Rc;
-use std::{fmt, io, net, time};
+use std::{fmt, io, net, ops, time};
 
 use tokio::io::{AsyncRead, AsyncWrite};
-use tokio::net::tcp::TcpStream;
+use tokio::net::TcpStream;
 
 #[derive(Debug, Clone)]
 pub struct ServerConfig {
@@ -13,6 +15,7 @@ pub struct ServerConfig {
 }
 
 impl ServerConfig {
+    #[inline]
     pub fn new(addr: SocketAddr) -> Self {
         ServerConfig {
             addr,
@@ -21,16 +24,19 @@ impl ServerConfig {
     }
 
     /// Returns the address of the local half of this TCP server socket
+    #[inline]
     pub fn local_addr(&self) -> SocketAddr {
         self.addr
     }
 
     /// Returns true if connection is secure (tls enabled)
+    #[inline]
     pub fn secure(&self) -> bool {
         self.secure.as_ref().get()
     }
 
     /// Set secure flag
+    #[inline]
     pub fn set_secure(&self) {
         self.secure.as_ref().set(true)
     }
@@ -114,7 +120,7 @@ impl<T, P> Io<T, P> {
     }
 }
 
-impl<T, P> std::ops::Deref for Io<T, P> {
+impl<T, P> ops::Deref for Io<T, P> {
     type Target = T;
 
     fn deref(&self) -> &T {
@@ -122,14 +128,14 @@ impl<T, P> std::ops::Deref for Io<T, P> {
     }
 }
 
-impl<T, P> std::ops::DerefMut for Io<T, P> {
+impl<T, P> ops::DerefMut for Io<T, P> {
     fn deref_mut(&mut self) -> &mut T {
         &mut self.io
     }
 }
 
 impl<T: fmt::Debug, P> fmt::Debug for Io<T, P> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(f, "Io {{{:?}}}", self.io)
     }
 }
@@ -171,7 +177,7 @@ impl IoStream for TcpStream {
     }
 }
 
-#[cfg(any(feature = "ssl"))]
+#[cfg(feature = "ssl")]
 impl<T: IoStream + Unpin> IoStream for tokio_openssl::SslStream<T> {
     #[inline]
     fn peer_addr(&self) -> Option<net::SocketAddr> {
@@ -194,8 +200,8 @@ impl<T: IoStream + Unpin> IoStream for tokio_openssl::SslStream<T> {
     }
 }
 
-#[cfg(any(feature = "rust-tls"))]
-impl<T: IoStream> IoStream for tokio_rustls::server::TlsStream<T> {
+#[cfg(feature = "rust-tls")]
+impl<T: IoStream + Unpin> IoStream for tokio_rustls::server::TlsStream<T> {
     #[inline]
     fn peer_addr(&self) -> Option<net::SocketAddr> {
         self.get_ref().0.peer_addr()
@@ -217,8 +223,8 @@ impl<T: IoStream> IoStream for tokio_rustls::server::TlsStream<T> {
     }
 }
 
-#[cfg(all(unix, feature = "uds"))]
-impl IoStream for t::UnixStream {
+#[cfg(unix)]
+impl IoStream for tokio::net::UnixStream {
     #[inline]
     fn peer_addr(&self) -> Option<net::SocketAddr> {
         None