From 26446fdbad82465bcfa278fa31ea783fed682a3b Mon Sep 17 00:00:00 2001 From: Ibraheem Ahmed Date: Fri, 28 Jan 2022 17:09:33 -0500 Subject: [PATCH 1/9] Replace `derive_more` with declarative macros (#438) Co-authored-by: Rob Ede --- actix-tls/CHANGES.md | 1 + actix-tls/Cargo.toml | 1 - actix-tls/src/accept/mod.rs | 37 +++++++++++++++++++++----- actix-tls/src/accept/native_tls.rs | 7 +++-- actix-tls/src/accept/openssl.rs | 7 +++-- actix-tls/src/accept/rustls.rs | 7 +++-- actix-tls/src/connect/connection.rs | 11 ++++---- actix-tls/src/connect/error.rs | 34 ++++++++++++++---------- actix-tls/src/impl_more.rs | 40 +++++++++++++++++++++++++++++ actix-tls/src/lib.rs | 2 ++ 10 files changed, 114 insertions(+), 33 deletions(-) create mode 100644 actix-tls/src/impl_more.rs diff --git a/actix-tls/CHANGES.md b/actix-tls/CHANGES.md index 02db1c55..1982b70c 100644 --- a/actix-tls/CHANGES.md +++ b/actix-tls/CHANGES.md @@ -16,6 +16,7 @@ [#429]: https://github.com/actix/actix-net/pull/429 + ## 3.0.0-rc.1 - 2021-11-29 ### Added - Derive `Debug` for `connect::Connection`. [#422] diff --git a/actix-tls/Cargo.toml b/actix-tls/Cargo.toml index 75ea26b0..61bd8bc9 100755 --- a/actix-tls/Cargo.toml +++ b/actix-tls/Cargo.toml @@ -47,7 +47,6 @@ actix-rt = { version = "2.2.0", default-features = false } actix-service = "2.0.0" actix-utils = "3.0.0" -derive_more = "0.99.5" futures-core = { version = "0.3.7", default-features = false, features = ["alloc"] } log = "0.4" pin-project-lite = "0.2.7" diff --git a/actix-tls/src/accept/mod.rs b/actix-tls/src/accept/mod.rs index de220ac5..46710df8 100644 --- a/actix-tls/src/accept/mod.rs +++ b/actix-tls/src/accept/mod.rs @@ -2,11 +2,12 @@ use std::{ convert::Infallible, + error::Error, + fmt, sync::atomic::{AtomicUsize, Ordering}, }; use actix_utils::counter::Counter; -use derive_more::{Display, Error}; #[cfg(feature = "openssl")] #[cfg_attr(docsrs, doc(cfg(feature = "openssl")))] @@ -43,23 +44,45 @@ pub fn max_concurrent_tls_connect(num: usize) { /// TLS handshake error, TLS timeout, or inner service error. /// /// All TLS acceptors from this crate will return the `SvcErr` type parameter as [`Infallible`], -/// which can be cast to your own service type, inferred or otherwise, -/// using [`into_service_error`](Self::into_service_error). -#[derive(Debug, Display, Error)] +/// which can be cast to your own service type, inferred or otherwise, using [`into_service_error`]. +/// +/// [`into_service_error`]: Self::into_service_error +#[derive(Debug)] pub enum TlsError { /// TLS handshake has timed-out. - #[display(fmt = "TLS handshake has timed-out")] Timeout, /// Wraps TLS service errors. - #[display(fmt = "TLS handshake error")] Tls(TlsErr), /// Wraps service errors. - #[display(fmt = "Service error")] Service(SvcErr), } +impl fmt::Display for TlsError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Timeout => f.write_str("TLS handshake has timed-out"), + Self::Tls(_) => f.write_str("TLS handshake error"), + Self::Service(_) => f.write_str("Service error"), + } + } +} + +impl Error for TlsError +where + TlsErr: Error + 'static, + SvcErr: Error + 'static, +{ + fn source(&self) -> Option<&(dyn Error + 'static)> { + match self { + TlsError::Tls(err) => Some(err), + TlsError::Service(err) => Some(err), + TlsError::Timeout => None, + } + } +} + impl TlsError { /// Casts the infallible service error type returned from acceptors into caller's type. /// diff --git a/actix-tls/src/accept/native_tls.rs b/actix-tls/src/accept/native_tls.rs index 9a864a72..b22c1ef2 100644 --- a/actix-tls/src/accept/native_tls.rs +++ b/actix-tls/src/accept/native_tls.rs @@ -20,11 +20,11 @@ use actix_utils::{ counter::Counter, future::{ready, Ready as FutReady}, }; -use derive_more::{Deref, DerefMut, From}; use futures_core::future::LocalBoxFuture; use tokio_native_tls::{native_tls::Error, TlsAcceptor}; use super::{TlsError, DEFAULT_TLS_HANDSHAKE_TIMEOUT, MAX_CONN_COUNTER}; +use crate::impl_more; pub mod reexports { //! Re-exports from `native-tls` that are useful for acceptors. @@ -33,9 +33,12 @@ pub mod reexports { } /// Wraps a `native-tls` based async TLS stream in order to implement [`ActixStream`]. -#[derive(Deref, DerefMut, From)] pub struct TlsStream(tokio_native_tls::TlsStream); +impl_more::from! { tokio_native_tls::TlsStream => TlsStream } +impl_more::deref! { TlsStream => 0: tokio_native_tls::TlsStream } +impl_more::deref_mut! { TlsStream => 0 } + impl AsyncRead for TlsStream { fn poll_read( self: Pin<&mut Self>, diff --git a/actix-tls/src/accept/openssl.rs b/actix-tls/src/accept/openssl.rs index 51a45942..6e65e5fc 100644 --- a/actix-tls/src/accept/openssl.rs +++ b/actix-tls/src/accept/openssl.rs @@ -21,11 +21,11 @@ use actix_utils::{ counter::{Counter, CounterGuard}, future::{ready, Ready as FutReady}, }; -use derive_more::{Deref, DerefMut, From}; use openssl::ssl::{Error, Ssl, SslAcceptor}; use pin_project_lite::pin_project; use super::{TlsError, DEFAULT_TLS_HANDSHAKE_TIMEOUT, MAX_CONN_COUNTER}; +use crate::impl_more; pub mod reexports { //! Re-exports from `openssl` that are useful for acceptors. @@ -36,9 +36,12 @@ pub mod reexports { } /// Wraps an `openssl` based async TLS stream in order to implement [`ActixStream`]. -#[derive(Deref, DerefMut, From)] pub struct TlsStream(tokio_openssl::SslStream); +impl_more::from! { tokio_openssl::SslStream => TlsStream } +impl_more::deref! { TlsStream => 0: tokio_openssl::SslStream } +impl_more::deref_mut! { TlsStream => 0 } + impl AsyncRead for TlsStream { fn poll_read( self: Pin<&mut Self>, diff --git a/actix-tls/src/accept/rustls.rs b/actix-tls/src/accept/rustls.rs index 4eca996e..35fbd34a 100644 --- a/actix-tls/src/accept/rustls.rs +++ b/actix-tls/src/accept/rustls.rs @@ -22,12 +22,12 @@ use actix_utils::{ counter::{Counter, CounterGuard}, future::{ready, Ready as FutReady}, }; -use derive_more::{Deref, DerefMut, From}; use pin_project_lite::pin_project; use tokio_rustls::rustls::ServerConfig; use tokio_rustls::{Accept, TlsAcceptor}; use super::{TlsError, DEFAULT_TLS_HANDSHAKE_TIMEOUT, MAX_CONN_COUNTER}; +use crate::impl_more; pub mod reexports { //! Re-exports from `rustls` that are useful for acceptors. @@ -36,9 +36,12 @@ pub mod reexports { } /// Wraps a `rustls` based async TLS stream in order to implement [`ActixStream`]. -#[derive(Deref, DerefMut, From)] pub struct TlsStream(tokio_rustls::server::TlsStream); +impl_more::from! { tokio_rustls::server::TlsStream => TlsStream } +impl_more::deref! { TlsStream => 0: tokio_rustls::server::TlsStream } +impl_more::deref_mut! { TlsStream => 0 } + impl AsyncRead for TlsStream { fn poll_read( self: Pin<&mut Self>, diff --git a/actix-tls/src/connect/connection.rs b/actix-tls/src/connect/connection.rs index 68972a2a..14c8dc00 100644 --- a/actix-tls/src/connect/connection.rs +++ b/actix-tls/src/connect/connection.rs @@ -1,17 +1,16 @@ -use derive_more::{Deref, DerefMut}; - use super::Host; +use crate::impl_more; /// Wraps underlying I/O and the connection request that initiated it. -#[derive(Debug, Deref, DerefMut)] +#[derive(Debug)] pub struct Connection { pub(crate) req: R, - - #[deref] - #[deref_mut] pub(crate) io: IO, } +impl_more::deref! { Connection => io: IO } +impl_more::deref_mut! { Connection => io } + impl Connection { /// Construct new `Connection` from request and IO parts. pub(crate) fn new(req: R, io: IO) -> Self { diff --git a/actix-tls/src/connect/error.rs b/actix-tls/src/connect/error.rs index 46944988..0452f4c3 100644 --- a/actix-tls/src/connect/error.rs +++ b/actix-tls/src/connect/error.rs @@ -1,30 +1,38 @@ -use std::{error::Error, io}; - -use derive_more::Display; +use std::{error::Error, fmt, io}; /// Errors that can result from using a connector service. -#[derive(Debug, Display)] +#[derive(Debug)] pub enum ConnectError { - /// Failed to resolve the hostname - #[display(fmt = "Failed resolving hostname")] + /// Failed to resolve the hostname. Resolver(Box), - /// No DNS records - #[display(fmt = "No DNS records found for the input")] + /// No DNS records. NoRecords, - /// Invalid input + /// Invalid input. InvalidInput, - /// Unresolved host name - #[display(fmt = "Connector received `Connect` method with unresolved host")] + /// Unresolved host name. Unresolved, - /// Connection IO error - #[display(fmt = "{}", _0)] + /// Connection IO error. Io(io::Error), } +impl fmt::Display for ConnectError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::NoRecords => f.write_str("No DNS records found for the input"), + Self::InvalidInput => f.write_str("Invalid input"), + Self::Unresolved => { + f.write_str("Connector received `Connect` method with unresolved host") + } + Self::Resolver(_) => f.write_str("Failed to resolve hostname"), + Self::Io(_) => f.write_str("I/O error"), + } + } +} + impl Error for ConnectError { fn source(&self) -> Option<&(dyn Error + 'static)> { match self { diff --git a/actix-tls/src/impl_more.rs b/actix-tls/src/impl_more.rs new file mode 100644 index 00000000..c380228b --- /dev/null +++ b/actix-tls/src/impl_more.rs @@ -0,0 +1,40 @@ +/// A helper to implement `Deref` for a type. +#[macro_export] +macro_rules! deref { + ($ty:ident $(<$($generic:ident),*>)? => $field:tt: $target:ty) => { + impl $(<$($generic),*>)? ::core::ops::Deref for $ty $(<$($generic),*>)? { + type Target = $target; + + fn deref(&self) -> &Self::Target { + &self.$field + } + } + }; +} + +/// A helper to implement `DerefMut` for a type. +#[macro_export] +macro_rules! deref_mut { + ($ty:ident $(<$($generic:ident),*>)? => $field:tt) => { + impl $(<$($generic),*>)? ::core::ops::DerefMut for $ty $(<$($generic),*>)? { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.$field + } + } + }; +} + +/// A helper to implement `From` for a unit struct. +#[macro_export] +macro_rules! from { + ($from:ty => $ty:ident $(<$($generic:ident),*>)?) => { + impl $(<$($generic),*>)? ::core::convert::From<$from> for $ty $(<$($generic),*>)? { + fn from(from: $from) -> Self { + Self(from) + } + } + }; +} + +#[allow(unused_imports)] +pub(crate) use crate::{deref, deref_mut, from}; diff --git a/actix-tls/src/lib.rs b/actix-tls/src/lib.rs index 39714dca..dfca00cd 100644 --- a/actix-tls/src/lib.rs +++ b/actix-tls/src/lib.rs @@ -18,3 +18,5 @@ pub mod accept; #[cfg(feature = "connect")] #[cfg_attr(docsrs, doc(cfg(feature = "connect")))] pub mod connect; + +mod impl_more; From 3e624b83764c7f539ce118e3d0cd66da62f143ab Mon Sep 17 00:00:00 2001 From: Babur <31780624+bobs4462@users.noreply.github.com> Date: Sat, 29 Jan 2022 01:09:54 +0300 Subject: [PATCH 2/9] Made `new` constructor for the Connection type public (#439) --- actix-tls/src/connect/connection.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actix-tls/src/connect/connection.rs b/actix-tls/src/connect/connection.rs index 14c8dc00..1abd4eff 100644 --- a/actix-tls/src/connect/connection.rs +++ b/actix-tls/src/connect/connection.rs @@ -13,7 +13,7 @@ impl_more::deref_mut! { Connection => io } impl Connection { /// Construct new `Connection` from request and IO parts. - pub(crate) fn new(req: R, io: IO) -> Self { + pub fn new(req: R, io: IO) -> Self { Self { req, io } } } From 941f67dec9b82c1a7bb1b77dc174ef921022da62 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Fri, 28 Jan 2022 21:46:17 +0000 Subject: [PATCH 3/9] s/e/err --- actix-codec/src/framed.rs | 6 +++--- actix-codec/tests/test_framed_sink.rs | 10 +++++----- actix-rt/examples/hyper.rs | 4 ++-- actix-server/src/accept.rs | 20 ++++++++++---------- actix-server/src/builder.rs | 8 ++++---- actix-server/src/service.rs | 4 ++-- actix-service/src/map.rs | 2 +- actix-tls/src/connect/openssl.rs | 9 ++++++--- actix-tls/src/connect/resolver.rs | 4 ++-- 9 files changed, 35 insertions(+), 32 deletions(-) diff --git a/actix-codec/src/framed.rs b/actix-codec/src/framed.rs index 997487c2..73dca006 100644 --- a/actix-codec/src/framed.rs +++ b/actix-codec/src/framed.rs @@ -193,7 +193,7 @@ impl Framed { match this.codec.decode_eof(this.read_buf) { Ok(Some(frame)) => return Poll::Ready(Some(Ok(frame))), Ok(None) => return Poll::Ready(None), - Err(e) => return Poll::Ready(Some(Err(e))), + Err(err) => return Poll::Ready(Some(Err(err))), } } @@ -204,7 +204,7 @@ impl Framed { log::trace!("frame decoded from buffer"); return Poll::Ready(Some(Ok(frame))); } - Err(e) => return Poll::Ready(Some(Err(e))), + Err(err) => return Poll::Ready(Some(Err(err))), _ => (), // Need more data } @@ -221,7 +221,7 @@ impl Framed { let cnt = match tokio_util::io::poll_read_buf(this.io, cx, this.read_buf) { Poll::Pending => return Poll::Pending, - Poll::Ready(Err(e)) => return Poll::Ready(Some(Err(e.into()))), + Poll::Ready(Err(err)) => return Poll::Ready(Some(Err(err.into()))), Poll::Ready(Ok(cnt)) => cnt, }; diff --git a/actix-codec/tests/test_framed_sink.rs b/actix-codec/tests/test_framed_sink.rs index aca4760d..15c3c292 100644 --- a/actix-codec/tests/test_framed_sink.rs +++ b/actix-codec/tests/test_framed_sink.rs @@ -50,7 +50,7 @@ impl Write for Bilateral { assert_eq!(&data[..], &src[..data.len()]); Ok(data.len()) } - Some(Err(e)) => Err(e), + Some(Err(err)) => Err(err), None => panic!("unexpected write; {:?}", src), } } @@ -67,13 +67,13 @@ impl AsyncWrite for Bilateral { buf: &[u8], ) -> Poll> { match Pin::get_mut(self).write(buf) { - Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => Pending, + Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => Pending, other => Ready(other), } } fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll> { match Pin::get_mut(self).flush() { - Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => Pending, + Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => Pending, other => Ready(other), } } @@ -99,8 +99,8 @@ impl AsyncRead for Bilateral { buf.put_slice(&data); Ready(Ok(())) } - Some(Err(ref e)) if e.kind() == WouldBlock => Pending, - Some(Err(e)) => Ready(Err(e)), + Some(Err(ref err)) if err.kind() == WouldBlock => Pending, + Some(Err(err)) => Ready(Err(err)), None => Ready(Ok(())), } } diff --git a/actix-rt/examples/hyper.rs b/actix-rt/examples/hyper.rs index 8bad1b33..3520acd0 100644 --- a/actix-rt/examples/hyper.rs +++ b/actix-rt/examples/hyper.rs @@ -21,8 +21,8 @@ fn main() { let server = Server::bind(&SocketAddr::from(([127, 0, 0, 1], 3000))).serve(make_service); - if let Err(e) = server.await { - eprintln!("server error: {}", e); + if let Err(err) = server.await { + eprintln!("server error: {}", err); } }) } diff --git a/actix-server/src/accept.rs b/actix-server/src/accept.rs index cd37460b..9f7872f8 100644 --- a/actix-server/src/accept.rs +++ b/actix-server/src/accept.rs @@ -127,10 +127,10 @@ impl Accept { let mut events = mio::Events::with_capacity(256); loop { - if let Err(e) = self.poll.poll(&mut events, self.timeout) { - match e.kind() { + if let Err(err) = self.poll.poll(&mut events, self.timeout) { + match err.kind() { io::ErrorKind::Interrupted => {} - _ => panic!("Poll error: {}", e), + _ => panic!("Poll error: {}", err), } } @@ -298,15 +298,15 @@ impl Accept { fn register_logged(&self, info: &mut ServerSocketInfo) { match self.register(info) { Ok(_) => debug!("Resume accepting connections on {}", info.lst.local_addr()), - Err(e) => error!("Can not register server socket {}", e), + Err(err) => error!("Can not register server socket {}", err), } } fn deregister_logged(&self, info: &mut ServerSocketInfo) { match self.poll.registry().deregister(&mut info.lst) { Ok(_) => debug!("Paused accepting connections on {}", info.lst.local_addr()), - Err(e) => { - error!("Can not deregister server socket {}", e) + Err(err) => { + error!("Can not deregister server socket {}", err) } } } @@ -396,10 +396,10 @@ impl Accept { let conn = Conn { io, token }; self.accept_one(conn); } - Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => return, - Err(ref e) if connection_error(e) => continue, - Err(e) => { - error!("Error accepting connection: {}", e); + Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => return, + Err(ref err) if connection_error(err) => continue, + Err(err) => { + error!("Error accepting connection: {}", err); // deregister listener temporary self.deregister_logged(info); diff --git a/actix-server/src/builder.rs b/actix-server/src/builder.rs index 805c6e75..ad41d056 100644 --- a/actix-server/src/builder.rs +++ b/actix-server/src/builder.rs @@ -220,10 +220,10 @@ impl ServerBuilder { { // The path must not exist when we try to bind. // Try to remove it to avoid bind error. - if let Err(e) = std::fs::remove_file(addr.as_ref()) { + if let Err(err) = std::fs::remove_file(addr.as_ref()) { // NotFound is expected and not an issue. Anything else is. - if e.kind() != std::io::ErrorKind::NotFound { - return Err(e); + if err.kind() != std::io::ErrorKind::NotFound { + return Err(err); } } @@ -273,7 +273,7 @@ pub(super) fn bind_addr( success = true; sockets.push(lst); } - Err(e) => err = Some(e), + Err(err) => err = Some(err), } } diff --git a/actix-server/src/service.rs b/actix-server/src/service.rs index 24d2450c..3a9aeee4 100644 --- a/actix-server/src/service.rs +++ b/actix-server/src/service.rs @@ -77,8 +77,8 @@ where }); Ok(()) } - Err(e) => { - error!("Can not convert to an async tcp stream: {}", e); + Err(err) => { + error!("Can not convert to an async tcp stream: {}", err); Err(()) } }) diff --git a/actix-service/src/map.rs b/actix-service/src/map.rs index 985a5433..49ddd9fe 100644 --- a/actix-service/src/map.rs +++ b/actix-service/src/map.rs @@ -97,7 +97,7 @@ where match this.fut.poll(cx) { Poll::Ready(Ok(resp)) => Poll::Ready(Ok((this.f)(resp))), - Poll::Ready(Err(e)) => Poll::Ready(Err(e)), + Poll::Ready(Err(err)) => Poll::Ready(Err(err)), Poll::Pending => Poll::Pending, } } diff --git a/actix-tls/src/connect/openssl.rs b/actix-tls/src/connect/openssl.rs index a6e40ae1..5739f6bc 100644 --- a/actix-tls/src/connect/openssl.rs +++ b/actix-tls/src/connect/openssl.rs @@ -141,9 +141,12 @@ where trace!("SSL Handshake success: {:?}", stream.hostname()); Poll::Ready(Ok(stream.replace_io(this.io.take().unwrap()).1)) } - Err(e) => { - trace!("SSL Handshake error: {:?}", e); - Poll::Ready(Err(io::Error::new(io::ErrorKind::Other, format!("{}", e)))) + Err(err) => { + trace!("SSL Handshake error: {:?}", err); + Poll::Ready(Err(io::Error::new( + io::ErrorKind::Other, + format!("{}", err), + ))) } } } diff --git a/actix-tls/src/connect/resolver.rs b/actix-tls/src/connect/resolver.rs index 8e700deb..245f919c 100644 --- a/actix-tls/src/connect/resolver.rs +++ b/actix-tls/src/connect/resolver.rs @@ -164,8 +164,8 @@ impl Future for ResolverFut { Self::LookUp(fut, req) => { let res = match ready!(Pin::new(fut).poll(cx)) { Ok(Ok(res)) => Ok(res), - Ok(Err(e)) => Err(ConnectError::Resolver(Box::new(e))), - Err(e) => Err(ConnectError::Io(e.into())), + Ok(Err(err)) => Err(ConnectError::Resolver(Box::new(err))), + Err(err) => Err(ConnectError::Io(err.into())), }; let req = req.take().unwrap(); From 0edb64575f28f6890bf902d59eda8184679c0f7b Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Fri, 28 Jan 2022 22:10:24 +0000 Subject: [PATCH 4/9] update tls changelog --- actix-tls/CHANGES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/actix-tls/CHANGES.md b/actix-tls/CHANGES.md index 1982b70c..0ac9a23f 100644 --- a/actix-tls/CHANGES.md +++ b/actix-tls/CHANGES.md @@ -1,6 +1,9 @@ # Changes ## Unreleased - 2021-xx-xx +- Expose `connect::Connection::new`. [#439] + +[#439]: https://github.com/actix/actix-net/pull/439 ## 3.0.1 - 2022-01-11 From 5e290d76f8011cc7deb5844f6180e8d396b45873 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Fri, 28 Jan 2022 22:11:21 +0000 Subject: [PATCH 5/9] prepare actix-tls release 3.0.2 --- actix-tls/CHANGES.md | 3 +++ actix-tls/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/actix-tls/CHANGES.md b/actix-tls/CHANGES.md index 0ac9a23f..da7bec65 100644 --- a/actix-tls/CHANGES.md +++ b/actix-tls/CHANGES.md @@ -1,6 +1,9 @@ # Changes ## Unreleased - 2021-xx-xx + + +## 3.0.2 - 2022-01-28 - Expose `connect::Connection::new`. [#439] [#439]: https://github.com/actix/actix-net/pull/439 diff --git a/actix-tls/Cargo.toml b/actix-tls/Cargo.toml index 61bd8bc9..28c8e04a 100755 --- a/actix-tls/Cargo.toml +++ b/actix-tls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-tls" -version = "3.0.1" +version = "3.0.2" authors = [ "Nikolay Kim ", "Rob Ede ", From b8a7741524afe679c4dc79f443b1de9534a943f2 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Fri, 28 Jan 2022 22:13:10 +0000 Subject: [PATCH 6/9] fix bind_addr --- actix-server/src/builder.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/actix-server/src/builder.rs b/actix-server/src/builder.rs index ad41d056..c3bc0269 100644 --- a/actix-server/src/builder.rs +++ b/actix-server/src/builder.rs @@ -264,22 +264,23 @@ pub(super) fn bind_addr( addr: S, backlog: u32, ) -> io::Result> { - let mut err = None; + let mut opt_err = None; let mut success = false; let mut sockets = Vec::new(); + for addr in addr.to_socket_addrs()? { match create_mio_tcp_listener(addr, backlog) { Ok(lst) => { success = true; sockets.push(lst); } - Err(err) => err = Some(err), + Err(err) => opt_err = Some(err), } } if success { Ok(sockets) - } else if let Some(err) = err.take() { + } else if let Some(err) = opt_err.take() { Err(err) } else { Err(io::Error::new( From 798869424226a602ee93e7292c4a6072466dcc46 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Fri, 28 Jan 2022 22:15:16 +0000 Subject: [PATCH 7/9] update msrv info --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a7cb8560..94b58958 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ See `actix-server/examples` and `actix-tls/examples` for some basic examples. ### MSRV -This repo's Minimum Supported Rust Version (MSRV) is 1.46.0. +Most crates in this repo's have a Minimum Supported Rust Version (MSRV) of 1.46.0. Only `actix-tls` +and `actix-server` have MSRV of 1.52.0. ## License From 59b629c74b550d1931fb114e53d2edd27325d7b6 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Fri, 28 Jan 2022 22:17:12 +0000 Subject: [PATCH 8/9] fix deps badge --- README.md | 2 +- actix-rt/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 94b58958..8eebb840 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![CI](https://github.com/actix/actix-net/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/actix/actix-net/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/actix/actix-net/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix-net) [![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x) -[![Dependency Status](https://deps.rs/repo/github/actix/actix-extras/status.svg)](https://deps.rs/repo/github/actix/actix-extras) +[![Dependency Status](https://deps.rs/repo/github/actix/actix-net/status.svg)](https://deps.rs/repo/github/actix/actix-net) ## Example diff --git a/actix-rt/Cargo.toml b/actix-rt/Cargo.toml index 7ca5b1c3..406c1de5 100644 --- a/actix-rt/Cargo.toml +++ b/actix-rt/Cargo.toml @@ -35,4 +35,4 @@ tokio-uring = { version = "0.2", optional = true } [dev-dependencies] tokio = { version = "1.13.1", features = ["full"] } -hyper = { version = "0.14", default-features = false, features = ["server", "tcp", "http1"] } +hyper = { version = "0.14.10", default-features = false, features = ["server", "tcp", "http1"] } From 72481313cc435aed95201ac1ff125fdf4d31f58b Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Fri, 28 Jan 2022 22:28:24 +0000 Subject: [PATCH 9/9] update readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8eebb840..639d6344 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,14 @@ > A collection of lower-level libraries for composable network services. -[![CI](https://github.com/actix/actix-net/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/actix/actix-net/actions/workflows/ci.yml) +[![CI](https://github.com/actix/actix-net/actions/workflows/ci.yml/badge.svg?event=push&style=flat-square)](https://github.com/actix/actix-net/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/actix/actix-net/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix-net) [![Chat on Discord](https://img.shields.io/discord/771444961383153695?label=chat&logo=discord)](https://discord.gg/NWpN5mmg3x) [![Dependency Status](https://deps.rs/repo/github/actix/actix-net/status.svg)](https://deps.rs/repo/github/actix/actix-net) -## Example +## Examples -See `actix-server/examples` and `actix-tls/examples` for some basic examples. +See example folders for [`actix-server`](./actix-server/examples) and [`actix-tls`](./actix-tls/examples). ### MSRV