chanmgr: trace-level logs when launching connections.

Based on more temporary debugging code. Yet another part of #677.
This commit is contained in:
Nick Mathewson 2022-12-06 08:49:55 -05:00 committed by eta
parent 71dfaa3125
commit 1e25a962a7
2 changed files with 15 additions and 0 deletions

View File

@ -9,6 +9,7 @@ use safelog::sensitive as sv;
use tor_error::bad_api_usage;
use tor_linkspec::{ChannelMethod, HasChanMethod, OwnedChanTarget};
use tor_rtcompat::{Runtime, TcpProvider};
use tracing::trace;
use crate::Error;
@ -50,6 +51,8 @@ impl<R: Runtime> crate::transport::TransportImplHelper for DefaultTransport<R> {
}
};
trace!("Launching direct connection for {}", target);
let (stream, addr) = connect_to_one(&self.runtime, &direct_addrs).await?;
let mut using_target = target.clone();
let _ignore = using_target.chan_method_mut().retain_addrs(|a| a == &addr);

View File

@ -26,6 +26,7 @@ use tor_rtcompat::TcpProvider;
use tor_socksproto::{
SocksAddr, SocksAuth, SocksClientHandshake, SocksCmd, SocksRequest, SocksStatus, SocksVersion,
};
use tracing::trace;
#[cfg(feature = "pt-client")]
use super::TransportImplHelper;
@ -69,6 +70,12 @@ pub(crate) async fn connect_via_proxy<R: TcpProvider + Send + Sync>(
protocol: &Protocol,
target: &PtTargetAddr,
) -> Result<R::TcpStream, ProxyError> {
trace!(
"Launching a proxied connection to {} via proxy at {} using {:?}",
target,
proxy,
protocol
);
let mut stream = runtime
.connect(proxy)
.await
@ -147,6 +154,11 @@ pub(crate) async fn connect_via_proxy<R: TcpProvider + Send + Sync>(
let status = reply
.ok_or_else(|| internal!("SOCKS protocol finished, but gave no status!"))?
.status();
trace!(
"SOCKS handshake with {} succeeded, with status {:?}",
proxy,
status
);
if status != SocksStatus::SUCCEEDED {
return Err(ProxyError::SocksError(status));