Skip to content

feat(client, server): remove the tcp cargo feature and related code #2878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
7551d26
feat(server): remove tcp feature gated server code
MrGunflame May 26, 2022
1b369a2
feat(server): remove failing examples using bind
MrGunflame May 27, 2022
157030f
feat(client): remove tcp dependant client code
MrGunflame May 27, 2022
7bb1f8f
feat(server,client): remove the tcp feature
MrGunflame May 27, 2022
bc3a1ca
feat(client): remove unused types and imports
MrGunflame May 28, 2022
bfef663
feat(client,server): Replace tcp feature dependent tests
MrGunflame Jun 19, 2022
4e6bbad
feat(client, server): Remove usage of `tcp`-dependant code from examples
MrGunflame Jun 27, 2022
81ace14
Merge https://github.com/hyperium/hyper into remove-tcp
MrGunflame Jul 4, 2022
829ab8d
feat(server, client): Update web_api example
MrGunflame Jul 4, 2022
3ada0e3
feat(server, client): Update tower_client example
MrGunflame Jul 4, 2022
baeda2f
feat(client): Fix tests/client.rs tests
MrGunflame Jul 10, 2022
a78760a
feat(server): Fix tests/server.rs tests
MrGunflame Jul 10, 2022
59a3187
feat(client, server): Fix integration tests
MrGunflame Jul 14, 2022
dc03d10
docs(feat, server): remove broken (useless) docs for tcp-gated code
MrGunflame Jul 19, 2022
5ccdae8
feat(server, client): fix the get_strip_connection_header test
MrGunflame Jul 19, 2022
33224af
feat(client, server): comment out benches depending on removed types
MrGunflame Jul 21, 2022
d779223
docs(server, client): remove broken doc links
MrGunflame Jul 21, 2022
46bce95
feat(client): remove GaiFuture
MrGunflame Jul 21, 2022
325aa56
feat(client, server): gate Exec::Default behind runtime feature
MrGunflame Jul 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ tokio = { version = "1", features = [
"sync",
"time",
"test-util",
"net",
] }
tokio-test = "0.4"
tokio-util = { version = "0.7", features = ["codec"] }
Expand Down Expand Up @@ -94,13 +95,6 @@ server = []

# Tokio support
runtime = [
"tcp",
"tokio/rt",
"tokio/time",
]
tcp = [
"socket2",
"tokio/net",
"tokio/rt",
"tokio/time",
]
Expand Down
61 changes: 32 additions & 29 deletions benches/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,38 @@

extern crate test;

use http::Uri;
use hyper::client::connect::HttpConnector;
use hyper::service::Service;
use std::net::SocketAddr;
use tokio::net::TcpListener;
// TODO: Reimplement http_connector bench using hyper::client::conn
// (instead of removed HttpConnector).

#[bench]
fn http_connector(b: &mut test::Bencher) {
let _ = pretty_env_logger::try_init();
let rt = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.expect("rt build");
let listener = rt
.block_on(TcpListener::bind(&SocketAddr::from(([127, 0, 0, 1], 0))))
.expect("bind");
let addr = listener.local_addr().expect("local_addr");
let dst: Uri = format!("http://{}/", addr).parse().expect("uri parse");
let mut connector = HttpConnector::new();
// use http::Uri;
// use hyper::client::connect::HttpConnector;
// use hyper::service::Service;
// use std::net::SocketAddr;
// use tokio::net::TcpListener;

rt.spawn(async move {
loop {
let _ = listener.accept().await;
}
});
// #[bench]
// fn http_connector(b: &mut test::Bencher) {
// let _ = pretty_env_logger::try_init();
// let rt = tokio::runtime::Builder::new_current_thread()
// .enable_all()
// .build()
// .expect("rt build");
// let listener = rt
// .block_on(TcpListener::bind(&SocketAddr::from(([127, 0, 0, 1], 0))))
// .expect("bind");
// let addr = listener.local_addr().expect("local_addr");
// let dst: Uri = format!("http://{}/", addr).parse().expect("uri parse");
// let mut connector = HttpConnector::new();

b.iter(|| {
rt.block_on(async {
connector.call(dst.clone()).await.expect("connect");
});
});
}
// rt.spawn(async move {
// loop {
// let _ = listener.accept().await;
// }
// });

// b.iter(|| {
// rt.block_on(async {
// connector.call(dst.clone()).await.expect("connect");
// });
// });
// }
Loading