diff --git a/examples/custom/Cargo.toml b/examples/custom/Cargo.toml index e755fd7..9cbbe02 100644 --- a/examples/custom/Cargo.toml +++ b/examples/custom/Cargo.toml @@ -8,18 +8,13 @@ name = "client" path = "src/client.rs" [dependencies] -ntex = "1.0.0-b.0" -ntex-h2 = "0.5.0-b.0" -ntex-grpc = "0.6.0-b.0" +ntex = "1.0" +ntex-h2 = "0.5" +ntex-grpc = "0.6" -clap = "3.2" -bitflags = "2.1" -log = "0.4" -env_logger = "0.10" -num_cpus = "1" -openssl = "0.10" +env_logger = "0.11" uuid = { version = "1.3", features = ["v4"] } [dev-dependencies] -env_logger = { version = "0.10", default-features = false } -ntex = { version = "1.0.0-b.0", features = ["openssl", "tokio"] } +env_logger = "0.11" +ntex = { version = "1.0", features = ["openssl", "tokio"] } diff --git a/examples/helloworld/Cargo.toml b/examples/helloworld/Cargo.toml index 608ae8f..00cf38a 100644 --- a/examples/helloworld/Cargo.toml +++ b/examples/helloworld/Cargo.toml @@ -12,18 +12,14 @@ name = "server" path = "src/server.rs" [dependencies] -ntex = "1.0.0-b.0" -ntex-grpc = "0.6.0-b.0" -ntex-h2 = "0.5.0-b.0" +ntex = "1.0" +ntex-grpc = "0.6" +ntex-h2 = "0.5" clap = "2" -bitflags = "1.3" log = "0.4" env_logger = "0.10" num_cpus = "1" -openssl = "0.10" [dev-dependencies] -ntex = { version = "1.0.0-b.0", features = ["openssl", "tokio"] } -ntex-tls = { version = "1.0.0-b.0", features = ["openssl"] } -ntex-connect = { version = "1.0.0-b.0", features = ["openssl", "tokio"] } +ntex = { version = "1.0", features = ["openssl", "tokio"] } diff --git a/ntex-grpc/CHANGES.md b/ntex-grpc/CHANGES.md index 67ac829..61883bb 100644 --- a/ntex-grpc/CHANGES.md +++ b/ntex-grpc/CHANGES.md @@ -1,5 +1,9 @@ # Changes +## [0.6.3] - 2024-03-25 + +* Remove ntex-connect dependency + ## [0.6.2] - 2024-02-01 * Handle broken protobuf frames diff --git a/ntex-grpc/Cargo.toml b/ntex-grpc/Cargo.toml index 0a02bcd..d188cae 100644 --- a/ntex-grpc/Cargo.toml +++ b/ntex-grpc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ntex-grpc" -version = "0.6.2" +version = "0.6.3" license = "MIT OR Apache-2.0" authors = ["Nikolay Kim "] description = "GRPC Client/Server framework" @@ -18,12 +18,10 @@ path = "src/lib.rs" [dependencies] ntex-h2 = "0.5" ntex-http = "0.1" -ntex-connect = "1.0" ntex-io = "1.0" ntex-util = "1.0" -ntex-bytes = "0.1.24" +ntex-bytes = "0.1" ntex-service = "2.0" -ntex-rt = "0.4" ntex-grpc-derive = "0.6" log = "0.4" @@ -33,6 +31,4 @@ pin-project-lite = "0.2" [dev-dependencies] openssl = "0.10" ntex = { version = "1.0", features = ["openssl", "tokio"] } -ntex-tls = { version = "1.0", features = ["openssl"] } -ntex-connect = { version = "1.0", features = ["openssl", "tokio"] } env_logger = { version = "0.10", default-features = false } diff --git a/ntex-grpc/src/client/connector.rs b/ntex-grpc/src/client/connector.rs deleted file mode 100644 index 2f61ce1..0000000 --- a/ntex-grpc/src/client/connector.rs +++ /dev/null @@ -1,84 +0,0 @@ -use std::{cell::RefCell, rc::Rc}; - -use ntex_connect::{Address, Connect, ConnectError, Connector as DefaultConnector}; -use ntex_h2::{self as h2, client}; -use ntex_io::IoBoxed; -use ntex_service::{fn_service, Pipeline, Service}; -use ntex_util::{future::Ready, HashMap}; - -use crate::client::{transport::Inner, Client, ClientError, ClientInformation}; - -pub struct Connector(Pipeline>); - -impl Connector -where - A: Address, -{ - /// Create new grpc connector - pub fn new(connector: client::Connector) -> Connector { - Connector(Pipeline::new(connector)) - } -} - -impl Clone for Connector -where - A: Address, -{ - fn clone(&self) -> Self { - Self(self.0.clone()) - } -} - -impl Default for Connector> -where - A: Address, -{ - fn default() -> Self { - Connector::new(client::Connector::default()) - } -} - -impl From> for Connector -where - A: Address, - T: Service, Error = ConnectError>, - IoBoxed: From, -{ - fn from(connector: client::Connector) -> Self { - Self(Pipeline::new(connector)) - } -} - -impl Connector -where - A: Address, - T: Service, Error = ConnectError>, - IoBoxed: From, -{ - /// Connect and create client instance - pub async fn create>( - &self, - address: A, - ) -> Result { - Ok(C::create(self.connect(address).await?)) - } - - /// Connect to http2 server - pub async fn connect(&self, address: A) -> Result { - let con = self.0.get_ref().connect(address).await?; - let inner = Rc::new(Inner { - client: con.client(), - inflight: RefCell::new(HashMap::default()), - }); - - let tr = inner.clone(); - ntex_rt::spawn(async move { - let _ = con - .start(fn_service(move |msg: h2::Message| { - Ready::from(tr.handle_message(msg)) - })) - .await; - }); - Ok(Client(inner)) - } -} diff --git a/ntex-grpc/src/server/service.rs b/ntex-grpc/src/server/service.rs index 12d1d39..e392a41 100644 --- a/ntex-grpc/src/server/service.rs +++ b/ntex-grpc/src/server/service.rs @@ -251,7 +251,7 @@ where } let data = data .split_to_checked(len as usize) - .ok_or_else(|| h2::StreamError::Reset(Reason::PROTOCOL_ERROR))?; + .ok_or(h2::StreamError::Reset(Reason::PROTOCOL_ERROR))?; log::debug!("Call service {} method {}", inflight.service, inflight.name); let req = ServerRequest { diff --git a/prost-build/src/extern_paths.rs b/prost-build/src/extern_paths.rs index 78229e5..bfcedec 100644 --- a/prost-build/src/extern_paths.rs +++ b/prost-build/src/extern_paths.rs @@ -105,7 +105,7 @@ impl ExternPaths { // protoc should always give fully qualified identifiers. assert_eq!(".", &pb_ident[..1]); - self.extern_paths.get(pb_ident).is_some() + self.extern_paths.contains_key(pb_ident) } pub fn resolve_ident(&self, pb_ident: &str) -> Option { diff --git a/prost-build/src/ident.rs b/prost-build/src/ident.rs index 5c48d0f..fad003a 100644 --- a/prost-build/src/ident.rs +++ b/prost-build/src/ident.rs @@ -42,9 +42,6 @@ pub fn to_upper_camel(s: &str) -> String { #[cfg(test)] mod tests { - - #![allow(clippy::cognitive_complexity)] - use super::*; #[test]