From 2955e49d78c5299fa8923c3b76d5e383baf829fc Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 18 Jul 2019 16:43:42 +0600 Subject: [PATCH] add unix domain sockets support --- actix-server-config/Cargo.toml | 8 ++++++-- actix-server-config/changes.md | 7 +++++++ actix-server-config/src/lib.rs | 25 ++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/actix-server-config/Cargo.toml b/actix-server-config/Cargo.toml index e33a9137..08af1acf 100644 --- a/actix-server-config/Cargo.toml +++ b/actix-server-config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-server-config" -version = "0.1.1" +version = "0.1.2" authors = ["Nikolay Kim "] description = "Actix server config utils" homepage = "https://actix.rs" @@ -14,7 +14,7 @@ name = "actix_server_config" path = "src/lib.rs" [package.metadata.docs.rs] -features = ["ssl", "rust-tls"] +features = ["ssl", "rust-tls", "uds"] [features] default = [] @@ -25,6 +25,9 @@ ssl = ["tokio-openssl"] # rustls rust-tls = ["rustls", "tokio-rustls"] +# unix domain sockets +uds = ["tokio-uds"] + [dependencies] futures = "0.1.25" tokio-io = "0.1.12" @@ -32,3 +35,4 @@ tokio-tcp = "0.1" tokio-openssl = { version="0.3.0", optional = true } rustls = { version = "0.15.2", optional = true } tokio-rustls = { version = "0.9.1", optional = true } +tokio-uds = { version="0.2.5", optional = true } diff --git a/actix-server-config/changes.md b/actix-server-config/changes.md index 9b5b1e09..7e8ebfbd 100644 --- a/actix-server-config/changes.md +++ b/actix-server-config/changes.md @@ -1,5 +1,12 @@ # Changes +## [0.1.2] - 2019-07-18 + +### Added + +* Add unix domnain sockets support + + ## [0.1.1] - 2019-04-16 ### Added diff --git a/actix-server-config/src/lib.rs b/actix-server-config/src/lib.rs index 557d1893..85f72bdb 100644 --- a/actix-server-config/src/lib.rs +++ b/actix-server-config/src/lib.rs @@ -95,9 +95,9 @@ impl Io { /// Return new Io object with new parameter. pub fn set(self, params: U) -> Io { Io { + params, io: self.io, proto: self.proto, - params: params, } } @@ -216,3 +216,26 @@ impl IoStream for tokio_rustls::TlsStream self.get_mut().0.set_keepalive(dur) } } + +#[cfg(all(unix, feature = "uds"))] +impl IoStream for tokio_uds::UnixStream { + #[inline] + fn peer_addr(&self) -> Option { + None + } + + #[inline] + fn set_nodelay(&mut self, _: bool) -> io::Result<()> { + Ok(()) + } + + #[inline] + fn set_linger(&mut self, _: Option) -> io::Result<()> { + Ok(()) + } + + #[inline] + fn set_keepalive(&mut self, _: Option) -> io::Result<()> { + Ok(()) + } +}