fix(connector): classify manual reconnect timeouts by stage (#2062)

This commit is contained in:
fanyang
2026-05-08 22:08:51 +08:00
committed by GitHub
parent 96fd39649a
commit 55f15bb6f0
2 changed files with 174 additions and 57 deletions
+12 -5
View File
@@ -636,20 +636,27 @@ impl PeerManager {
#[tracing::instrument]
pub async fn try_direct_connect_with_peer_id_hint<C>(
&self,
mut connector: C,
connector: C,
peer_id_hint: Option<PeerId>,
) -> Result<(PeerId, PeerConnId), Error>
where
C: TunnelConnector + Debug,
{
let ns = self.global_ctx.net_ns.clone();
let t = ns
.run_async(|| async move { connector.connect().await })
.await?;
let t = self.connect_tunnel(connector).await?;
self.add_client_tunnel_with_peer_id_hint(t, true, peer_id_hint)
.await
}
pub(crate) async fn connect_tunnel<C>(&self, mut connector: C) -> Result<Box<dyn Tunnel>, Error>
where
C: TunnelConnector + Debug,
{
let ns = self.global_ctx.net_ns.clone();
Ok(ns
.run_async(|| async move { connector.connect().await })
.await?)
}
// avoid loop back to virtual network
fn check_remote_addr_not_from_virtual_network(
&self,