diff --git a/proxydetoxlib/src/context.rs b/proxydetoxlib/src/context.rs index a2d4c9c..a863a1b 100644 --- a/proxydetoxlib/src/context.rs +++ b/proxydetoxlib/src/context.rs @@ -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, proxy: ProxyOrDirect, diff --git a/proxydetoxlib/src/session.rs b/proxydetoxlib/src/session.rs index 18cd118..16ddb63 100644 --- a/proxydetoxlib/src/session.rs +++ b/proxydetoxlib/src/session.rs @@ -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));