Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 7 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ url = "2.5"
serde = { version = "1.0", features = ["derive"] }
serde_urlencoded = "0.7.1"
tower = { version = "0.5.2", default-features = false, features = ["timeout", "util", "retry"] }
tower-http = { version = "0.6.6", default-features = false, optional = true }
tower-service = "0.3"
sync_wrapper = { version = "1.0", features = ["futures"] }

Expand All @@ -78,15 +77,13 @@ bytes = "1.2"
http = "1"
http-body = "1"
tokio = { version = "1", default-features = false, features = ["net","time","rt"] }
atomic-waker = "1.1.2"
futures-channel = "0.3.31"
futures-util = { version = "0.3.31", default-features = false }
http2 = { version = "0.5.4", features = ["unstable"]}
http-body-util = "0.1"
httparse = "1.9"
pin-project-lite = "0.2.4"
smallvec = { version = "1.12", features = ["const_generics", "const_new"] }
tracing = { version = "0.1", default-features = false, features = ["std"], optional = true }
want = "0.3"
socket2 = { version = "0.5.10", features = ["all"] }
percent-encoding = "2.3"
Expand Down Expand Up @@ -120,6 +117,9 @@ webpki-root-certs = { version = "1.0.0", optional = true }
cookie_crate = { version = "0.18", package = "cookie", optional = true }
cookie_store = { version = "0.21", features = ["preserve_order"], optional = true }

## tower http
tower-http = { version = "0.6.6", default-features = false, optional = true }

## tokio util
tokio-util = { version = "0.7.15", default-features = false, features = ["codec","io"], optional = true }

Expand All @@ -132,6 +132,9 @@ tokio-tungstenite = { version = "0.27.0", default-features = false, features = [
## hickory-dns
hickory-resolver = { version = "0.25.2", optional = true }

## tracing
tracing = { version = "0.1", default-features = false, features = ["std"], optional = true }

## windows system proxy
[target.'cfg(windows)'.dependencies]
windows-registry = { version = "0.5.2", optional = true }
Expand All @@ -140,7 +143,7 @@ windows-registry = { version = "0.5.2", optional = true }
[target.'cfg(target_os = "macos")'.dependencies]
system-configuration = { version = "0.6.1", optional = true }

## Interface binding
## interface binding
[target.'cfg(any(target_os = "ios", target_os = "visionos", target_os = "macos", target_os = "tvos", target_os = "watchos", target = "illumos", target = "solaris"))'.dependencies]
libc = "0.2.173"

Expand Down
3 changes: 2 additions & 1 deletion src/core/client/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ impl<T, U> Receiver<T, U> {
}

pub(crate) fn try_recv(&mut self) -> Option<(T, Callback<T, U>)> {
match crate::core::common::task::now_or_never(self.inner.recv()) {
use futures_util::FutureExt;
match self.inner.recv().now_or_never() {
Some(Some(mut env)) => env.0.take(),
_ => None,
}
Expand Down
47 changes: 0 additions & 47 deletions src/core/common/either.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/core/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pub(crate) mod buf;
pub(crate) mod either;
pub(crate) mod io;
pub(crate) mod task;
pub(crate) mod time;
Expand Down
14 changes: 0 additions & 14 deletions src/core/common/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,3 @@ pub(crate) fn yield_now(cx: &mut Context<'_>) -> Poll<std::convert::Infallible>
cx.waker().wake_by_ref();
Poll::Pending
}

/// Poll the future once and return `Some` if it is ready, else `None`.
///
/// If the future wasn't ready, the future likely can't be driven to completion any more: the
/// polling uses a no-op waker, so knowledge of what the pending future was waiting for is lost.
pub(crate) fn now_or_never<F: std::future::Future>(fut: F) -> Option<F::Output> {
let waker = std::task::Waker::noop();
let mut cx = Context::from_waker(waker);
let fut = std::pin::pin!(fut);
match fut.poll(&mut cx) {
Poll::Ready(res) => Some(res),
Poll::Pending => None,
}
}
2 changes: 1 addition & 1 deletion src/core/common/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::{
task,
};

use atomic_waker::AtomicWaker;
use futures_util::task::AtomicWaker;

type Value = usize;

Expand Down
8 changes: 4 additions & 4 deletions src/core/proto/h2/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use futures_channel::{
oneshot,
};
use futures_util::{
future::FusedFuture,
future::{Either, FusedFuture},
stream::{FusedStream, Stream},
};
use http::{Method, Request, Response, StatusCode};
Expand All @@ -33,7 +33,7 @@ use super::{
use crate::core::{
body::Incoming as IncomingBody,
client::dispatch::{self, Callback, SendWhen, TrySendError},
common::{either::Either, io::Compat, time::Time},
common::{io::Compat, time::Time},
error::BoxError,
ext::{Protocol, RequestConfig, RequestOriginalHeaders},
proto::{Dispatched, h2::UpgradedSendStream, headers},
Expand Down Expand Up @@ -225,9 +225,9 @@ where
let (recorder, ponger) = ping::channel(pp, ping_config, timer);

let conn: Conn<_, B> = Conn::new(ponger, conn);
(Either::left(conn), recorder)
(Either::Left(conn), recorder)
} else {
(Either::right(conn), ping::disabled())
(Either::Right(conn), ping::disabled())
};
let conn: ConnMapErr<T, B> = ConnMapErr {
conn,
Expand Down
Loading