aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md4
-rw-r--r--src/transport/libp2p/driver.rs4
-rw-r--r--src/transport/libp2p/relays.rs8
3 files changed, 8 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 560c4af..d419282 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,10 @@ it from the release before ([`docs/operations.md`](docs/operations.md),
## Unreleased
+* Over libp2p, a node connected to a peer only through a relay dials it directly as soon
+ as it knows where, even while hole punching dials it elsewhere, rather than after that
+ dial failed ([`src/transport/libp2p/relays.rs`](src/transport/libp2p/relays.rs)).
+
* Over libp2p, messages sent to a node at once all come in: of their streams, all but
one were dropped unread, and a joining node's first proof of who it is, two of them,
went unanswered for 10 seconds ([`src/transport/libp2p/mod.rs`](src/transport/libp2p/mod.rs);
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 {