From 495e5f4b381e8060ae38dbad9bcae0426ce08ed4 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 28 May 2024 22:53:58 +0500 Subject: [PATCH] Use ntex-2.0 for tests (#35) --- Cargo.toml | 11 +++++------ src/client/pool.rs | 2 +- src/client/simple.rs | 2 +- src/connection.rs | 4 ++-- src/dispatcher.rs | 3 +-- tests/connection.rs | 2 +- tests/support/mod.rs | 2 +- 7 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6711b19..ff6a225 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,14 +20,13 @@ default = [] unstable = [] [dependencies] -ntex-net = "2.0" -ntex-io = "2.0" +ntex-net = "2" +ntex-io = "2" ntex-http = "0.1" ntex-bytes = "0.1" ntex-codec = "0.6" -ntex-service = "3.0" -ntex-util = "2.0" -ntex-rt = "0.4" +ntex-service = "3" +ntex-util = "2" bitflags = "2" fxhash = "0.2" @@ -47,7 +46,7 @@ walkdir = "2.3.2" serde = "1.0" serde_json = "1.0" -ntex = { version = "1", features = ["openssl", "tokio"] } +ntex = { version = "2", features = ["openssl", "tokio"] } ntex-tls = { version = "2", features = ["openssl"] } ntex-net = { version = "2", features = ["tokio"] } openssl = "0.10" diff --git a/src/client/pool.rs b/src/client/pool.rs index bec10f9..e5a629d 100644 --- a/src/client/pool.rs +++ b/src/client/pool.rs @@ -126,7 +126,7 @@ impl Client { let (tx, rx) = oneshot::channel(); let inner = self.inner.clone(); let waiters = self.waiters.clone(); - let _ = ntex_rt::spawn(async move { + let _ = ntex_util::spawn(async move { let res = match timeout_checked(inner.conn_timeout, (*inner.connector)()).await { Ok(Ok(io)) => { diff --git a/src/client/simple.rs b/src/client/simple.rs index 67c1a15..92ef88c 100644 --- a/src/client/simple.rs +++ b/src/client/simple.rs @@ -60,7 +60,7 @@ impl SimpleClient { disp, &con.config().dispatcher_config, ); - let _ = ntex_rt::spawn(async move { + let _ = ntex_util::spawn(async move { let _ = fut.await; }); diff --git a/src/connection.rs b/src/connection.rs index 44685a1..2e544b7 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -4,8 +4,8 @@ use std::{collections::VecDeque, time::Instant}; use ntex_bytes::{ByteString, Bytes}; use ntex_http::{HeaderMap, Method}; use ntex_io::IoRef; -use ntex_rt::spawn; -use ntex_util::{channel::pool, future::Either, time, time::now, time::sleep, HashMap, HashSet}; +use ntex_util::time::{self, now, sleep}; +use ntex_util::{channel::pool, future::Either, spawn, HashMap, HashSet}; use crate::config::{Config, ConfigInner}; use crate::error::{ConnectionError, OperationError, StreamError, StreamErrorInner}; diff --git a/src/dispatcher.rs b/src/dispatcher.rs index 1f93364..e137436 100644 --- a/src/dispatcher.rs +++ b/src/dispatcher.rs @@ -1,10 +1,9 @@ use std::{fmt, future::poll_fn, future::Future, rc::Rc, task::Poll}; use ntex_io::DispatchItem; -use ntex_rt::spawn; use ntex_service::{Pipeline, Service, ServiceCtx}; use ntex_util::future::{join, join_all, Either}; -use ntex_util::HashMap; +use ntex_util::{spawn, HashMap}; use crate::connection::{Connection, RecvHalfConnection}; use crate::control::{Control, ControlAck}; diff --git a/tests/connection.rs b/tests/connection.rs index f7e4c38..7e1ca79 100644 --- a/tests/connection.rs +++ b/tests/connection.rs @@ -61,7 +61,7 @@ async fn connect(addr: net::SocketAddr) -> IoBoxed { .map_err(|e| log::error!("Cannot set alpn protocol: {:?}", e)); let addr = ntex::connect::Connect::new("localhost").set_addr(Some(addr)); - openssl::Connector::new(builder.build()) + openssl::SslConnector::new(builder.build()) .connect(addr) .await .unwrap() diff --git a/tests/support/mod.rs b/tests/support/mod.rs index 8d7b567..eaa1747 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -23,7 +23,7 @@ pub fn start_server(io: IoTest) -> mpsc::Receiver { io.remote_buffer_cap(1000000); let (tx, rx) = mpsc::channel(); - ntex_rt::spawn(async move { + ntex_util::spawn(async move { let _ = server::Server::new( Config::server(), fn_service(|msg: Control<()>| async move {