Skip to content

Commit

Permalink
Upgrade to ntex-net (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 authored Mar 24, 2024
1 parent 4e23b71 commit 1c818c0
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

## [0.5.2] - 2024-03-24

* Use ntex-net

## [0.5.1] - 2024-03-12

* Rename `ControlMessage` to `Control`
Expand Down
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ntex-h2"
version = "0.5.1"
version = "0.5.2"
license = "MIT OR Apache-2.0"
authors = ["Nikolay Kim <[email protected]>"]
description = "An HTTP/2 client and server"
Expand All @@ -19,12 +19,12 @@ default = []
unstable = []

[dependencies]
ntex-connect = "1.0.0"
ntex-io = "1.0.0"
ntex-net = "1.0"
ntex-io = "1.0"
ntex-http = "0.1.11"
ntex-bytes = "0.1.21"
ntex-bytes = "0.1.24"
ntex-codec = "0.6.2"
ntex-service = "2.0.0"
ntex-service = "2.0"
ntex-util = "1.0.0"
ntex-rt = "0.4.11"

Expand All @@ -46,13 +46,13 @@ walkdir = "2.3.2"
serde = "1.0.0"
serde_json = "1.0.0"

ntex = { version = "1.1", features = ["openssl", "tokio"] }
ntex-tls = { version = "1.0", features = ["openssl"] }
ntex = { version = "1.2", features = ["openssl", "tokio"] }
ntex-tls = { version = "1.1", features = ["openssl"] }
ntex-net = { version = "1.0", features = ["tokio"] }
openssl = "0.10"

# Examples
env_logger = { version = "0.11", default-features = false }
ntex-connect = { version = "1.0", features = ["openssl", "tokio"] }

[patch.crates-io]
ntex-h2 = { path = "." }
3 changes: 1 addition & 2 deletions examples/client.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::error::Error;

use ntex_bytes::Bytes;
use ntex_connect as connect;
use ntex_h2::{client, MessageKind};
use ntex_http::{header, uri::Scheme, HeaderMap, Method};
use ntex_util::time::{sleep, Seconds};
Expand All @@ -20,7 +19,7 @@ pub async fn main() -> Result<(), Box<dyn Error>> {

let pool = client::Client::build(
"127.0.0.1:5928",
connect::openssl::Connector::new(builder.build()),
ntex_tls::openssl::SslConnector::new(builder.build()),
)
.scheme(Scheme::HTTPS)
.finish();
Expand Down
2 changes: 1 addition & 1 deletion examples/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_BACKTRACE", "1");
env_logger::init();

ntex::server::Server::build()
ntex::server::build()
.bind("http", "127.0.0.1:5928", move |_| {
server::Server::build()
.configure(|cfg| cfg.max_concurrent_streams(10))
Expand Down
2 changes: 1 addition & 1 deletion examples/tls-server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async fn main() -> std::io::Result<()> {
});
let acceptor = builder.build();

ntex::server::Server::build()
ntex::server::build()
.bind("http", "127.0.0.1:5928", move |_| {
SslAcceptor::new(acceptor.clone())
.map_err(|_err| server::ServerError::Service(()))
Expand Down
2 changes: 1 addition & 1 deletion src/client/connector.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::{cell::Cell, marker::PhantomData, ops};

use ntex_bytes::{ByteString, PoolId, PoolRef};
use ntex_connect::{self as connect, Address, Connect, Connector as DefaultConnector};
use ntex_http::uri::Scheme;
use ntex_io::IoBoxed;
use ntex_net::connect::{self as connect, Address, Connect, Connector as DefaultConnector};
use ntex_service::{IntoService, Pipeline, Service};
use ntex_util::time::timeout_checked;

Expand Down
6 changes: 3 additions & 3 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub enum ClientError {
HandshakeTimeout,
/// Connect error
#[error("Connect error: {0}")]
Connect(Box<ntex_connect::ConnectError>),
Connect(Box<ntex_net::connect::ConnectError>),
/// Peer disconnected
#[error("Peer disconnected err: {0}")]
Disconnected(#[from] std::io::Error),
Expand All @@ -47,8 +47,8 @@ impl From<ntex_util::channel::Canceled> for ClientError {
}
}

impl From<ntex_connect::ConnectError> for ClientError {
fn from(err: ntex_connect::ConnectError) -> Self {
impl From<ntex_net::connect::ConnectError> for ClientError {
fn from(err: ntex_net::connect::ConnectError) -> Self {
Self::Connect(Box::new(err))
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use std::{cell::Cell, cell::RefCell, collections::VecDeque, fmt, rc::Rc, time::D

use nanorand::{Rng, WyRand};
use ntex_bytes::{ByteString, PoolId, PoolRef};
use ntex_connect::{self as connect, Address, Connect, Connector as DefaultConnector};
use ntex_http::{uri::Scheme, HeaderMap, Method};
use ntex_io::IoBoxed;
use ntex_net::connect::{self as connect, Address, Connect, Connector as DefaultConnector};
use ntex_service::{IntoService, Pipeline, Service};
use ntex_util::time::{timeout_checked, Millis, Seconds};
use ntex_util::{channel::oneshot, future::BoxFuture};
Expand Down

0 comments on commit 1c818c0

Please sign in to comment.