aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport/libp2p
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/libp2p')
-rw-r--r--src/transport/libp2p/driver.rs4
-rw-r--r--src/transport/libp2p/relays.rs8
2 files changed, 4 insertions, 8 deletions
diff --git a/src/transport/libp2p/driver.rs b/src/transport/libp2p/driver.rs
index 6ef04e7..9f12cea 100644
--- a/src/transport/libp2p/driver.rs
+++ b/src/transport/libp2p/driver.rs
@@ -297,10 +297,6 @@ pub(super) async fn run(
}
find_on_dht(&mut swarm, peer);
}
- // A dial that kept ours from going (`upgrade`) is over.
- if let Some(peer) = peer_id {
- upgrade(&mut swarm, &book, peer, relaying.local);
- }
}
SwarmEvent::NewListenAddr { address, .. } => {
// libp2p listens on every interface it's told to; the ranges left
diff --git a/src/transport/libp2p/relays.rs b/src/transport/libp2p/relays.rs
index 1a57635..0539ac5 100644
--- a/src/transport/libp2p/relays.rs
+++ b/src/transport/libp2p/relays.rs
@@ -127,9 +127,9 @@ pub(super) fn pick_relays(
/// too (the member list, identify, mDNS), since the first connection, made through a
/// relay (a relayed seed), would otherwise be kept for good: a peer connected isn't
/// dialled again, and hole punching needs both sides to listen. The direct connection,
-/// once open, wins over the relayed one (`Book::duplicates`). A dial refused because
-/// another to the peer is under way (hole punching's, say) doesn't count as a try: the
-/// next comes when that one fails (`driver`), not `UPGRADE_RETRY` later.
+/// once open, wins over the relayed one (`Book::duplicates`). It goes even while another
+/// dial to the peer is under way: hole punching's goes to the address the relay saw, which
+/// may not answer where these do, until its dial times out.
pub(super) fn upgrade(
swarm: &mut Swarm<Behaviour>,
book: &Mutex<Book>,
@@ -160,7 +160,7 @@ pub(super) fn upgrade(
let dialled = swarm.dial(
DialOpts::peer_id(peer)
.addresses(direct.clone())
- .condition(PeerCondition::NotDialing)
+ .condition(PeerCondition::Always)
.build(),
);
match dialled {