From 8f05986a9f3cb5013b1cfea8d68b11c4bf1dfd33 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 3 Oct 2019 14:55:44 +0900 Subject: [PATCH 01/12] Use `map()` instead of `and_then()` (#51) --- router/src/url.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/router/src/url.rs b/router/src/url.rs index 79fe2b63..a45e2cd8 100644 --- a/router/src/url.rs +++ b/router/src/url.rs @@ -195,7 +195,7 @@ fn from_hex(v: u8) -> Option { #[inline] fn restore_ch(d1: u8, d2: u8) -> Option { - from_hex(d1).and_then(|d1| from_hex(d2).and_then(move |d2| Some(d1 << 4 | d2))) + from_hex(d1).and_then(|d1| from_hex(d2).map(move |d2| d1 << 4 | d2)) } #[cfg(test)] From e733c562d95cc5dca7637bb9bf64925fb7d41d65 Mon Sep 17 00:00:00 2001 From: Jerome Gravel-Niquet Date: Thu, 3 Oct 2019 14:32:32 -0400 Subject: [PATCH 02/12] Update rustls, tokio-rustls and webpki across the board (#42) * Update rustls, tokio-rustls and webpki across the board * bump minimum rust version to 1.37 * updated readme and changelogs to reflect changes and minimum required rust version --- .travis.yml | 2 +- README.md | 2 +- actix-connect/CHANGES.md | 7 +++++++ actix-connect/Cargo.toml | 6 +++--- actix-connect/src/ssl/rustls.rs | 13 +++++-------- actix-server-config/Cargo.toml | 4 ++-- actix-server-config/changes.md | 7 +++++++ actix-server-config/src/lib.rs | 2 +- actix-server/CHANGES.md | 7 +++++++ actix-server/Cargo.toml | 8 ++++---- actix-server/src/ssl/rustls.rs | 10 +++++----- 11 files changed, 43 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 21c3ebc4..6eaf6d1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ matrix: include: - rust: stable - rust: beta - - rust: 1.36.0 + - rust: 1.37.0 - rust: nightly-2019-06-15 allow_failures: - rust: nightly-2019-06-15 diff --git a/README.md b/README.md index 99ecd5fc..5c100657 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Actix net - framework for composable network services * [API Documentation (Development)](https://actix.rs/actix-net/actix_net/) * [Chat on gitter](https://gitter.im/actix/actix) * Cargo package: [actix-net](https://crates.io/crates/actix-net) -* Minimum supported Rust version: 1.36 or later +* Minimum supported Rust version: 1.37 or later ## Example diff --git a/actix-connect/CHANGES.md b/actix-connect/CHANGES.md index 95ac002e..00dfe4d6 100644 --- a/actix-connect/CHANGES.md +++ b/actix-connect/CHANGES.md @@ -1,5 +1,12 @@ # Changes +## Next + +### Changed + +* Update `rustls` to 0.16 +* Minimum required Rust version upped to 1.37.0 + ## [0.2.5] - 2019-09-05 * Add `TcpConnectService` diff --git a/actix-connect/Cargo.toml b/actix-connect/Cargo.toml index d7d0c276..4a2a0146 100644 --- a/actix-connect/Cargo.toml +++ b/actix-connect/Cargo.toml @@ -51,9 +51,9 @@ openssl = { version="0.10", optional = true } tokio-openssl = { version="0.3", optional = true } #rustls -rustls = { version = "0.15.2", optional = true } -tokio-rustls = { version = "0.9.1", optional = true } -webpki = { version = "0.19", optional = true } +rustls = { version = "0.16.0", optional = true } +tokio-rustls = { version = "0.10.0", optional = true } +webpki = { version = "0.21", optional = true } [dev-dependencies] bytes = "0.4" diff --git a/actix-connect/src/ssl/rustls.rs b/actix-connect/src/ssl/rustls.rs index 9a518507..7d6f5720 100644 --- a/actix-connect/src/ssl/rustls.rs +++ b/actix-connect/src/ssl/rustls.rs @@ -5,10 +5,7 @@ use actix_codec::{AsyncRead, AsyncWrite}; use actix_service::{NewService, Service}; use futures::{future::ok, future::FutureResult, Async, Future, Poll}; use std::sync::Arc; -use tokio_rustls::{ - rustls::{ClientConfig, ClientSession}, - Connect, TlsConnector, TlsStream, -}; +use tokio_rustls::{client::TlsStream, rustls::ClientConfig, Connect, TlsConnector}; use webpki::DNSNameRef; use crate::{Address, Connection}; @@ -37,7 +34,7 @@ where connector: Arc, ) -> impl Service< Request = Connection, - Response = Connection>, + Response = Connection>, Error = std::io::Error, > { RustlsConnectorService { @@ -61,7 +58,7 @@ where U: AsyncRead + AsyncWrite + fmt::Debug, { type Request = Connection; - type Response = Connection>; + type Response = Connection>; type Error = std::io::Error; type Config = (); type Service = RustlsConnectorService; @@ -86,7 +83,7 @@ where U: AsyncRead + AsyncWrite + fmt::Debug, { type Request = Connection; - type Response = Connection>; + type Response = Connection>; type Error = std::io::Error; type Future = ConnectAsyncExt; @@ -114,7 +111,7 @@ impl Future for ConnectAsyncExt where U: AsyncRead + AsyncWrite + fmt::Debug, { - type Item = Connection>; + type Item = Connection>; type Error = std::io::Error; fn poll(&mut self) -> Poll { diff --git a/actix-server-config/Cargo.toml b/actix-server-config/Cargo.toml index 08af1acf..3e892742 100644 --- a/actix-server-config/Cargo.toml +++ b/actix-server-config/Cargo.toml @@ -33,6 +33,6 @@ futures = "0.1.25" tokio-io = "0.1.12" 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 } +rustls = { version = "0.16.0", optional = true } +tokio-rustls = { version = "0.10.0", 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 7e8ebfbd..6f514080 100644 --- a/actix-server-config/changes.md +++ b/actix-server-config/changes.md @@ -1,5 +1,12 @@ # Changes +## Next + +### Changed + +* Update `rustls` to 0.16 +* Minimum required Rust version upped to 1.37.0 + ## [0.1.2] - 2019-07-18 ### Added diff --git a/actix-server-config/src/lib.rs b/actix-server-config/src/lib.rs index 85f72bdb..fc5dac04 100644 --- a/actix-server-config/src/lib.rs +++ b/actix-server-config/src/lib.rs @@ -195,7 +195,7 @@ impl IoStream for tokio_openssl::SslStream { } #[cfg(any(feature = "rust-tls"))] -impl IoStream for tokio_rustls::TlsStream { +impl IoStream for tokio_rustls::server::TlsStream { #[inline] fn peer_addr(&self) -> Option { self.get_ref().0.peer_addr() diff --git a/actix-server/CHANGES.md b/actix-server/CHANGES.md index 6ab3bcc9..c317b56d 100644 --- a/actix-server/CHANGES.md +++ b/actix-server/CHANGES.md @@ -1,5 +1,12 @@ # Changes +## Next + +### Changed + +* Update `rustls` to 0.16 +* Minimum required Rust version upped to 1.37.0 + ## [0.6.1] - 2019-09-25 ### Added diff --git a/actix-server/Cargo.toml b/actix-server/Cargo.toml index 2bda582a..30183a08 100644 --- a/actix-server/Cargo.toml +++ b/actix-server/Cargo.toml @@ -65,10 +65,10 @@ openssl = { version="0.10", optional = true } tokio-openssl = { version="0.3", optional = true } # rustls -rustls = { version = "0.15.2", optional = true } -tokio-rustls = { version = "0.9.1", optional = true } -webpki = { version = "0.19", optional = true } -webpki-roots = { version = "0.16", optional = true } +rustls = { version = "0.16.0", optional = true } +tokio-rustls = { version = "0.10.0", optional = true } +webpki = { version = "0.21", optional = true } +webpki-roots = { version = "0.17", optional = true } [dev-dependencies] bytes = "0.4" diff --git a/actix-server/src/ssl/rustls.rs b/actix-server/src/ssl/rustls.rs index 151bbbd6..06edc0f5 100644 --- a/actix-server/src/ssl/rustls.rs +++ b/actix-server/src/ssl/rustls.rs @@ -4,9 +4,9 @@ use std::sync::Arc; use actix_service::{NewService, Service}; use futures::{future::ok, future::FutureResult, Async, Future, Poll}; -use rustls::{ServerConfig, ServerSession}; +use rustls::ServerConfig; use tokio_io::{AsyncRead, AsyncWrite}; -use tokio_rustls::{Accept, TlsAcceptor, TlsStream}; +use tokio_rustls::{server::TlsStream, Accept, TlsAcceptor}; use crate::counter::{Counter, CounterGuard}; use crate::ssl::MAX_CONN_COUNTER; @@ -41,7 +41,7 @@ impl Clone for RustlsAcceptor { impl NewService for RustlsAcceptor { type Request = Io; - type Response = Io, P>; + type Response = Io, P>; type Error = io::Error; type Config = SrvConfig; @@ -70,7 +70,7 @@ pub struct RustlsAcceptorService { impl Service for RustlsAcceptorService { type Request = Io; - type Response = Io, P>; + type Response = Io, P>; type Error = io::Error; type Future = RustlsAcceptorServiceFut; @@ -102,7 +102,7 @@ where } impl Future for RustlsAcceptorServiceFut { - type Item = Io, P>; + type Item = Io, P>; type Error = io::Error; fn poll(&mut self) -> Poll { From fba2002702295b82d98405db36d2b628831ba35f Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Fri, 4 Oct 2019 06:21:59 +0900 Subject: [PATCH 03/12] Prepare actix-connect release (#53) --- actix-connect/CHANGES.md | 2 +- actix-connect/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/actix-connect/CHANGES.md b/actix-connect/CHANGES.md index 00dfe4d6..baea3d30 100644 --- a/actix-connect/CHANGES.md +++ b/actix-connect/CHANGES.md @@ -1,6 +1,6 @@ # Changes -## Next +## [0.3.0] - 2019-10-03 ### Changed diff --git a/actix-connect/Cargo.toml b/actix-connect/Cargo.toml index 4a2a0146..517a185b 100644 --- a/actix-connect/Cargo.toml +++ b/actix-connect/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-connect" -version = "0.2.5" +version = "0.3.0" authors = ["Nikolay Kim "] description = "Actix Connector - tcp connector service" keywords = ["network", "framework", "async", "futures"] From 2667850d6002942abce895ef8302dfafd8e831c7 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Fri, 4 Oct 2019 09:13:33 +0900 Subject: [PATCH 04/12] Prepare actix-server-config release (#54) * Prepare actix-server-config release * Bump up actix-server-config to 0.2.0 --- actix-connect/Cargo.toml | 2 +- actix-ioframe/Cargo.toml | 2 +- actix-server-config/Cargo.toml | 2 +- actix-server-config/changes.md | 2 +- actix-server/Cargo.toml | 2 +- actix-test-server/Cargo.toml | 2 +- actix-testing/Cargo.toml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/actix-connect/Cargo.toml b/actix-connect/Cargo.toml index 517a185b..15e24cbc 100644 --- a/actix-connect/Cargo.toml +++ b/actix-connect/Cargo.toml @@ -58,4 +58,4 @@ webpki = { version = "0.21", optional = true } [dev-dependencies] bytes = "0.4" actix-testing = { version="0.1.0" } -actix-server-config = "0.1.0" +actix-server-config = "0.2.0" diff --git a/actix-ioframe/Cargo.toml b/actix-ioframe/Cargo.toml index b5838832..7eac1f9b 100644 --- a/actix-ioframe/Cargo.toml +++ b/actix-ioframe/Cargo.toml @@ -30,6 +30,6 @@ log = "0.4" actix-rt = "0.2.2" actix-connect = "0.2.0" actix-testing = "0.1.0" -actix-server-config = "0.1.1" +actix-server-config = "0.2.0" tokio-tcp = "0.1" tokio-timer = "0.2" diff --git a/actix-server-config/Cargo.toml b/actix-server-config/Cargo.toml index 3e892742..5c7053be 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.2" +version = "0.2.0" authors = ["Nikolay Kim "] description = "Actix server config utils" homepage = "https://actix.rs" diff --git a/actix-server-config/changes.md b/actix-server-config/changes.md index 6f514080..9af452a5 100644 --- a/actix-server-config/changes.md +++ b/actix-server-config/changes.md @@ -1,6 +1,6 @@ # Changes -## Next +## [0.2.0] - 2019-10-03 ### Changed diff --git a/actix-server/Cargo.toml b/actix-server/Cargo.toml index 30183a08..5420b140 100644 --- a/actix-server/Cargo.toml +++ b/actix-server/Cargo.toml @@ -38,7 +38,7 @@ uds = ["mio-uds", "tokio-uds", "actix-server-config/uds"] [dependencies] actix-rt = "0.2.2" actix-service = "0.4.1" -actix-server-config = "0.1.2" +actix-server-config = "0.2.0" log = "0.4" num_cpus = "1.0" diff --git a/actix-test-server/Cargo.toml b/actix-test-server/Cargo.toml index 8e063c38..2ce973a3 100644 --- a/actix-test-server/Cargo.toml +++ b/actix-test-server/Cargo.toml @@ -19,7 +19,7 @@ path = "src/lib.rs" [dependencies] actix-rt = "0.2.1" actix-server = "0.5.0" -actix-server-config = "0.1.0" +actix-server-config = "0.2.0" actix-testing = "0.1.0" log = "0.4" diff --git a/actix-testing/Cargo.toml b/actix-testing/Cargo.toml index 3c101b13..10d42edc 100644 --- a/actix-testing/Cargo.toml +++ b/actix-testing/Cargo.toml @@ -19,7 +19,7 @@ path = "src/lib.rs" [dependencies] actix-rt = "0.2.1" actix-server = "0.6.0" -actix-server-config = "0.1.0" +actix-server-config = "0.2.0" actix-service = "0.4.0" log = "0.4" From f6f9e1fcdb1fcefad69adc8c4cb3f71e5d80738f Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Fri, 4 Oct 2019 07:30:13 +0200 Subject: [PATCH 05/12] Add an error message if we receive a non-hostname-based dest This is more helpful than an unwrap and at least points users at the right location. Upstream issue is https://github.com/briansmith/webpki/issues/54 --- actix-connect/src/ssl/rustls.rs | 3 ++- actix-connect/tests/test_connect.rs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/actix-connect/src/ssl/rustls.rs b/actix-connect/src/ssl/rustls.rs index 7d6f5720..465ef1e4 100644 --- a/actix-connect/src/ssl/rustls.rs +++ b/actix-connect/src/ssl/rustls.rs @@ -94,7 +94,8 @@ where fn call(&mut self, stream: Connection) -> Self::Future { trace!("SSL Handshake start for: {:?}", stream.host()); let (io, stream) = stream.replace(()); - let host = DNSNameRef::try_from_ascii_str(stream.host()).unwrap(); + let host = DNSNameRef::try_from_ascii_str(stream.host()) + .expect("rustls currently only handles hostname-based connections. See https://github.com/briansmith/webpki/issues/54"); ConnectAsyncExt { fut: TlsConnector::from(self.connector.clone()).connect(host, io), stream: Some(stream), diff --git a/actix-connect/tests/test_connect.rs b/actix-connect/tests/test_connect.rs index a8fdb1b6..471dd314 100644 --- a/actix-connect/tests/test_connect.rs +++ b/actix-connect/tests/test_connect.rs @@ -42,6 +42,7 @@ fn test_rustls_string() { let con = test::call_service(&mut conn, addr.into()); assert_eq!(con.peer_addr().unwrap(), srv.addr()); } + #[test] fn test_static_str() { let srv = TestServer::with(|| { From e3155957a8db7ac8e2f429508da9459455a8e7ba Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Fri, 4 Oct 2019 17:36:23 +0900 Subject: [PATCH 06/12] Prepare actix-server release (#55) --- actix-server/CHANGES.md | 2 +- actix-server/Cargo.toml | 2 +- actix-testing/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/actix-server/CHANGES.md b/actix-server/CHANGES.md index c317b56d..1b3aa478 100644 --- a/actix-server/CHANGES.md +++ b/actix-server/CHANGES.md @@ -1,6 +1,6 @@ # Changes -## Next +## [0.7.0] - 2019-10-04 ### Changed diff --git a/actix-server/Cargo.toml b/actix-server/Cargo.toml index 5420b140..3720b887 100644 --- a/actix-server/Cargo.toml +++ b/actix-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-server" -version = "0.6.1" +version = "0.7.0" authors = ["Nikolay Kim "] description = "Actix server - General purpose tcp server" keywords = ["network", "framework", "async", "futures"] diff --git a/actix-testing/Cargo.toml b/actix-testing/Cargo.toml index 10d42edc..b11e6455 100644 --- a/actix-testing/Cargo.toml +++ b/actix-testing/Cargo.toml @@ -18,7 +18,7 @@ path = "src/lib.rs" [dependencies] actix-rt = "0.2.1" -actix-server = "0.6.0" +actix-server = "0.7.0" actix-server-config = "0.2.0" actix-service = "0.4.0" From fa72975f34d2f3b19860240a3b564afb02037ff7 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 8 Oct 2019 14:46:22 +0600 Subject: [PATCH 07/12] extra trace logging --- actix-codec/src/framed_read.rs | 1 + actix-ioframe/src/dispatcher.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/actix-codec/src/framed_read.rs b/actix-codec/src/framed_read.rs index f54b2c23..b470d1bf 100644 --- a/actix-codec/src/framed_read.rs +++ b/actix-codec/src/framed_read.rs @@ -209,6 +209,7 @@ where // get a spurious 0 that looks like EOF self.buffer.reserve(1); if 0 == try_ready!(self.inner.read_buf(&mut self.buffer)) { + trace!("read 0 bytes, mark stream as eof"); self.eof = true; } diff --git a/actix-ioframe/src/dispatcher.rs b/actix-ioframe/src/dispatcher.rs index 422a10d4..57713b10 100644 --- a/actix-ioframe/src/dispatcher.rs +++ b/actix-ioframe/src/dispatcher.rs @@ -147,6 +147,7 @@ where } Ok(Async::NotReady) => return false, Ok(Async::Ready(None)) => { + log::trace!("Client disconnected"); self.dispatch_state = FramedState::Stopping; return true; } From 9982a9498d5c36be672101e939d9576cd681aa52 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 8 Oct 2019 15:02:43 +0600 Subject: [PATCH 08/12] register current task in counters available method. --- actix-utils/CHANGES.md | 5 +++++ actix-utils/Cargo.toml | 2 +- actix-utils/src/counter.rs | 17 ++++++++++------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/actix-utils/CHANGES.md b/actix-utils/CHANGES.md index 97131b76..d2db8811 100644 --- a/actix-utils/CHANGES.md +++ b/actix-utils/CHANGES.md @@ -1,5 +1,10 @@ # Changes +## [0.4.6] - 2019-10-08 + +* Refactor `Counter` type. register current task in available method. + + ## [0.4.5] - 2019-07-19 ### Removed diff --git a/actix-utils/Cargo.toml b/actix-utils/Cargo.toml index f4f11ab6..b687d030 100644 --- a/actix-utils/Cargo.toml +++ b/actix-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-utils" -version = "0.4.5" +version = "0.4.6" authors = ["Nikolay Kim "] description = "Actix utils - various actix net related services" keywords = ["network", "framework", "async", "futures"] diff --git a/actix-utils/src/counter.rs b/actix-utils/src/counter.rs index 1302c91c..2f355094 100644 --- a/actix-utils/src/counter.rs +++ b/actix-utils/src/counter.rs @@ -25,11 +25,13 @@ impl Counter { })) } + /// Get counter guard. pub fn get(&self) -> CounterGuard { CounterGuard::new(self.0.clone()) } - /// Check if counter is not at capacity + /// Check if counter is not at capacity. If counter at capacity + /// it registers notification for current task. pub fn available(&self) -> bool { self.0.available() } @@ -57,11 +59,7 @@ impl Drop for CounterGuard { impl CounterInner { fn inc(&self) { - let num = self.count.get() + 1; - self.count.set(num); - if num == self.capacity { - self.task.register(); - } + self.count.set(self.count.get() + 1); } fn dec(&self) { @@ -73,6 +71,11 @@ impl CounterInner { } fn available(&self) -> bool { - self.count.get() < self.capacity + if self.count.get() < self.capacity { + true + } else { + self.task.register(); + false + } } } From 35e32d8e553924d26e4c729793618e72364c71a0 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 14 Oct 2019 10:30:27 +0600 Subject: [PATCH 09/12] prepare actix-testing release --- Cargo.toml | 26 -------------------------- actix-testing/CHANGES.md | 5 +++++ actix-testing/Cargo.toml | 6 +++--- 3 files changed, 8 insertions(+), 29 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7b33514f..f489c5c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,18 +1,3 @@ -[package] -name = "actix-net" -version = "0.3.0" -authors = ["Nikolay Kim "] -description = "Actix net - framework for the composable network services for Rust" -readme = "README.md" -keywords = ["network", "framework", "async", "futures"] -homepage = "https://actix.rs" -repository = "https://github.com/actix/actix-net.git" -documentation = "https://docs.rs/actix-net/" -categories = ["network-programming", "asynchronous"] -license = "MIT/Apache-2.0" -exclude = [".gitignore", ".travis.yml", ".cargo/config", "appveyor.yml"] -edition = "2018" - [workspace] members = [ "actix-codec", @@ -28,17 +13,6 @@ members = [ "router", ] -[dev-dependencies] -actix-service = "0.4.0" -actix-codec = "0.1.1" -actix-rt = "0.2.0" -actix-server = { version="0.5.0", features=["ssl"] } -env_logger = "0.6" -futures = "0.1.25" -openssl = "0.10" -tokio-tcp = "0.1" -tokio-openssl = "0.3" - [patch.crates-io] actix-codec = { path = "actix-codec" } actix-connect = { path = "actix-connect" } diff --git a/actix-testing/CHANGES.md b/actix-testing/CHANGES.md index 3dfd22fb..7896c18e 100644 --- a/actix-testing/CHANGES.md +++ b/actix-testing/CHANGES.md @@ -1,5 +1,10 @@ # Changes +## [0.2.0] - 2019-10-14 + +* Upgrade actix-server and actix-server-config deps + + ## [0.1.0] - 2019-09-25 * Initial impl diff --git a/actix-testing/Cargo.toml b/actix-testing/Cargo.toml index b11e6455..eb9ac455 100644 --- a/actix-testing/Cargo.toml +++ b/actix-testing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-testing" -version = "0.1.0" +version = "0.2.0" authors = ["Nikolay Kim "] description = "Actix testing utils" keywords = ["network", "framework", "async", "futures"] @@ -17,10 +17,10 @@ name = "actix_testing" path = "src/lib.rs" [dependencies] -actix-rt = "0.2.1" +actix-rt = "0.2.5" actix-server = "0.7.0" actix-server-config = "0.2.0" -actix-service = "0.4.0" +actix-service = "0.4.2" log = "0.4" net2 = "0.2" From 0b0060fe47f1a5bc8921b33571b530df64ee17fe Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 14 Oct 2019 10:37:48 +0600 Subject: [PATCH 10/12] update deps --- actix-connect/Cargo.toml | 2 +- actix-ioframe/Cargo.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/actix-connect/Cargo.toml b/actix-connect/Cargo.toml index 15e24cbc..0fa5c903 100644 --- a/actix-connect/Cargo.toml +++ b/actix-connect/Cargo.toml @@ -57,5 +57,5 @@ webpki = { version = "0.21", optional = true } [dev-dependencies] bytes = "0.4" -actix-testing = { version="0.1.0" } +actix-testing = { version="0.2.0" } actix-server-config = "0.2.0" diff --git a/actix-ioframe/Cargo.toml b/actix-ioframe/Cargo.toml index 7eac1f9b..53639e36 100644 --- a/actix-ioframe/Cargo.toml +++ b/actix-ioframe/Cargo.toml @@ -28,8 +28,8 @@ log = "0.4" [dev-dependencies] actix-rt = "0.2.2" -actix-connect = "0.2.0" -actix-testing = "0.1.0" +actix-connect = "0.3.0" +actix-testing = "0.2.0" actix-server-config = "0.2.0" tokio-tcp = "0.1" tokio-timer = "0.2" From 115e82329fe47f3aad5c3b946c01821bf849f90d Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 14 Oct 2019 11:19:08 +0600 Subject: [PATCH 11/12] fix arbiter thread panic message --- actix-rt/CHANGES.md | 7 +++++++ actix-rt/src/arbiter.rs | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/actix-rt/CHANGES.md b/actix-rt/CHANGES.md index c82a0d07..98f6a601 100644 --- a/actix-rt/CHANGES.md +++ b/actix-rt/CHANGES.md @@ -1,5 +1,12 @@ # Changes +## [0.2.6] - Unreleased + +### Fixed + +* Fix arbiter's thread panic message. + + ## [0.2.5] - 2019-09-02 ### Added diff --git a/actix-rt/src/arbiter.rs b/actix-rt/src/arbiter.rs index 285ad3c9..083105b3 100644 --- a/actix-rt/src/arbiter.rs +++ b/actix-rt/src/arbiter.rs @@ -260,9 +260,11 @@ struct ArbiterController { impl Drop for ArbiterController { fn drop(&mut self) { if thread::panicking() { - eprintln!("Panic in Arbiter thread, shutting down system."); if System::current().stop_on_panic() { + eprintln!("Panic in Arbiter thread, shutting down system."); System::current().stop_with_code(1) + } else { + eprintln!("Panic in Arbiter thread."); } } } From 2e8c2c77337ac3f7a1a0fd2d3c8636a163c8607a Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 14 Oct 2019 17:55:52 +0600 Subject: [PATCH 12/12] Re-register task on every future poll --- actix-ioframe/CHANGES.md | 6 ++++++ actix-ioframe/Cargo.toml | 2 +- actix-ioframe/src/cell.rs | 4 ++++ actix-ioframe/src/dispatcher.rs | 3 ++- actix-utils/CHANGES.md | 5 +++++ actix-utils/Cargo.toml | 2 +- actix-utils/src/framed.rs | 3 ++- 7 files changed, 21 insertions(+), 4 deletions(-) diff --git a/actix-ioframe/CHANGES.md b/actix-ioframe/CHANGES.md index 90905f5f..a7aa244f 100644 --- a/actix-ioframe/CHANGES.md +++ b/actix-ioframe/CHANGES.md @@ -1,5 +1,11 @@ # Changes + +## [0.1.1] - 2019-10-14 + +* Re-register task on every dispatcher poll. + + ## [0.1.0] - 2019-09-25 * Initial release diff --git a/actix-ioframe/Cargo.toml b/actix-ioframe/Cargo.toml index 53639e36..97e32152 100644 --- a/actix-ioframe/Cargo.toml +++ b/actix-ioframe/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-ioframe" -version = "0.1.0" +version = "0.1.1" authors = ["Nikolay Kim "] description = "Actix framed service" keywords = ["network", "framework", "async", "futures"] diff --git a/actix-ioframe/src/cell.rs b/actix-ioframe/src/cell.rs index e517aca1..3e82aee4 100644 --- a/actix-ioframe/src/cell.rs +++ b/actix-ioframe/src/cell.rs @@ -29,6 +29,10 @@ impl Cell { } } + pub(crate) unsafe fn get_ref(&mut self) -> &T { + &*self.inner.as_ref().get() + } + pub(crate) unsafe fn get_mut(&mut self) -> &mut T { &mut *self.inner.as_ref().get() } diff --git a/actix-ioframe/src/dispatcher.rs b/actix-ioframe/src/dispatcher.rs index 57713b10..05a7d05f 100644 --- a/actix-ioframe/src/dispatcher.rs +++ b/actix-ioframe/src/dispatcher.rs @@ -154,7 +154,6 @@ where }; let mut cell = self.inner.clone(); - unsafe { cell.get_mut().task.register() }; tokio_current_thread::spawn( self.service .call(Item::new(self.state.clone(), self.sink.clone(), item)) @@ -275,6 +274,8 @@ where type Error = ServiceError; fn poll(&mut self) -> Poll { + unsafe { self.inner.get_ref().task.register() }; + match mem::replace(&mut self.dispatch_state, FramedState::Processing) { FramedState::Processing => { if self.poll_read() || self.poll_write() { diff --git a/actix-utils/CHANGES.md b/actix-utils/CHANGES.md index d2db8811..4e4ac8d7 100644 --- a/actix-utils/CHANGES.md +++ b/actix-utils/CHANGES.md @@ -1,5 +1,10 @@ # Changes +## [0.4.7] - 2019-10-14 + +* Re-register task on every framed transport poll. + + ## [0.4.6] - 2019-10-08 * Refactor `Counter` type. register current task in available method. diff --git a/actix-utils/Cargo.toml b/actix-utils/Cargo.toml index b687d030..ee3c1dba 100644 --- a/actix-utils/Cargo.toml +++ b/actix-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-utils" -version = "0.4.6" +version = "0.4.7" authors = ["Nikolay Kim "] description = "Actix utils - various actix net related services" keywords = ["network", "framework", "async", "futures"] diff --git a/actix-utils/src/framed.rs b/actix-utils/src/framed.rs index 7be2c750..2fa2d8e9 100644 --- a/actix-utils/src/framed.rs +++ b/actix-utils/src/framed.rs @@ -129,7 +129,6 @@ where }; let mut cell = self.inner.clone(); - cell.get_mut().task.register(); tokio_current_thread::spawn(self.service.call(item).then(move |item| { let inner = cell.get_mut(); inner.buf.push_back(item); @@ -293,6 +292,8 @@ where type Error = FramedTransportError; fn poll(&mut self) -> Poll { + self.inner.get_ref().task.register(); + match mem::replace(&mut self.state, TransportState::Processing) { TransportState::Processing => { if self.poll_read() || self.poll_write() {