From b26115d7c5673838a482f525399e76c4696c1832 Mon Sep 17 00:00:00 2001
From: Rob Ede <robjtede@icloud.com>
Date: Mon, 29 Nov 2021 20:42:13 +0000
Subject: [PATCH] tweaks

---
 actix-tls/CHANGES.md                   |  7 ++++---
 actix-tls/src/connect/connect_addrs.rs |  3 ++-
 actix-tls/src/connect/connection.rs    | 10 +++++-----
 actix-tls/src/connect/tcp.rs           |  4 +++-
 4 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/actix-tls/CHANGES.md b/actix-tls/CHANGES.md
index c320bc85..514b3e94 100644
--- a/actix-tls/CHANGES.md
+++ b/actix-tls/CHANGES.md
@@ -3,10 +3,10 @@
 ## Unreleased - 2021-xx-xx
 ### Added
 * Derive `Debug` for `connect::Connection`. [#422]
+* Implement `Display` for `accept::TlsError`. [#422]
+* Implement `Error` for `accept::TlsError` where both types also implement `Error`. [#422]
 * Implement `Default` for `connect::Resolver`. [#422]
-* Implement `Display` for `TlsError`. [#422]
-* Implement `Error` for `ConnectError`. [#422]
-* Implement `Error` for `TlsError` where both types also implement `Error`. [#422]
+* Implement `Error` for `connect::ConnectError`. [#422]
 
 ### Changed
 * There are now no default features. [#422]
@@ -20,6 +20,7 @@
 * Rename struct `connect::{ConnectService => ConnectorService}`. [#422]
 * Rename struct `connect::{ConnectServiceFactory => Connector}`. [#422]
 * Rename TLS acceptor service future types and hide from docs. [#422]
+* Unbox some service futures types. [#422]
 
 ### Removed
 * Remove `connect::{new_connector, new_connector_factory, default_connector, default_connector_factory}` methods. [#422]
diff --git a/actix-tls/src/connect/connect_addrs.rs b/actix-tls/src/connect/connect_addrs.rs
index 7b15a8e5..6d27e3cc 100644
--- a/actix-tls/src/connect/connect_addrs.rs
+++ b/actix-tls/src/connect/connect_addrs.rs
@@ -4,10 +4,11 @@ use std::{
     net::SocketAddr,
 };
 
-#[derive(Debug, Eq, PartialEq, Hash)]
+#[derive(Debug, Clone, Eq, PartialEq, Hash)]
 pub(crate) enum ConnectAddrs {
     None,
     One(SocketAddr),
+    // TODO: consider using smallvec
     Multi(VecDeque<SocketAddr>),
 }
 
diff --git a/actix-tls/src/connect/connection.rs b/actix-tls/src/connect/connection.rs
index f713546d..4b454ef1 100644
--- a/actix-tls/src/connect/connection.rs
+++ b/actix-tls/src/connect/connection.rs
@@ -13,14 +13,14 @@ pub struct Connection<R, IO> {
 }
 
 impl<R, IO> Connection<R, IO> {
-    /// Construct new `Connection` from
-    pub(crate) fn new(io: IO, req: R) -> Self {
-        Self { io, req }
+    /// Construct new `Connection` from request and IO parts.
+    pub(crate) fn new(req: R, io: IO) -> Self {
+        Self { req, io }
     }
 }
 
 impl<R, IO> Connection<R, IO> {
-    /// Deconstructs into parts.
+    /// Deconstructs into IO and request parts.
     pub fn into_parts(self) -> (IO, R) {
         (self.io, self.req)
     }
@@ -47,7 +47,7 @@ impl<R, IO> Connection<R, IO> {
 }
 
 impl<R: Host, IO> Connection<R, IO> {
-    /// Get hostname.
+    /// Returns hostname.
     pub fn hostname(&self) -> &str {
         self.req.hostname()
     }
diff --git a/actix-tls/src/connect/tcp.rs b/actix-tls/src/connect/tcp.rs
index 2538bd87..a4b6efc9 100755
--- a/actix-tls/src/connect/tcp.rs
+++ b/actix-tls/src/connect/tcp.rs
@@ -148,12 +148,14 @@ impl<R: Host> Future for TcpConnectorFut<R> {
                 match ready!(stream.poll(cx)) {
                     Ok(sock) => {
                         let req = req.take().unwrap();
+
                         trace!(
                             "TCP connector: successfully connected to {:?} - {:?}",
                             req.hostname(),
                             sock.peer_addr()
                         );
-                        return Poll::Ready(Ok(Connection::new(sock, req)));
+
+                        return Poll::Ready(Ok(Connection::new(req, sock)));
                     }
 
                     Err(err) => {