Skip to content

Commit

Permalink
Demote errors to warning in parallel connect
Browse files Browse the repository at this point in the history
  • Loading branch information
kiron1 committed Dec 23, 2024
1 parent e6246a3 commit 1c939b2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion proxydetoxlib/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl Context {
/// In case of `CONNECT` the connesction will be established so far that `CONNECT` request is
/// send, but not the client request.
/// For upstream servers which can be connected directly a TCP connection will be established.
#[instrument(level = "debug", skip(self, method, uri), err, fields(proxy = %proxy, duration))]
#[instrument(level = "debug", skip(self, method, uri), fields(proxy = %proxy, duration))]
pub(super) async fn connect(
self: Arc<Self>,
proxy: ProxyOrDirect,
Expand Down
16 changes: 15 additions & 1 deletion proxydetoxlib/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,21 @@ impl Inner {
let cx = self.context.clone();
let method = req.method();
let uri = req.uri();
move |p| cx.clone().connect(p, method.clone(), uri.clone())
move |p| {
let cx = cx.clone();
let race = cx.race_connect;
async move {
let r = cx.connect(p, method.clone(), uri.clone()).await;
if let Err(ref cause) = r {
if race {
tracing::debug!(%cause, "unable to connect");
} else {
tracing::warn!(%cause, "unable to connect");
}
}
r
}
}
});

let conn = Box::pin(stream::iter(conn));
Expand Down

0 comments on commit 1c939b2

Please sign in to comment.