Skip to content

Commit 0df8ddc

Browse files
apollo_network: constant dialing fix (#10144)
1 parent f203485 commit 0df8ddc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

crates/apollo_network/src/discovery/behaviours/bootstrapping/bootstrap_peer.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub struct BootstrapPeerEventStream {
3535
sleeper: Option<Pin<Box<Sleep>>>,
3636
}
3737

38+
#[derive(Debug, PartialEq, Eq)]
3839
enum DialMode {
3940
Dialing,
4041
Connected,
@@ -54,6 +55,10 @@ impl BootstrapPeerEventStream {
5455
FromSwarm::DialFailure(DialFailure { peer_id: Some(peer_id), .. })
5556
if peer_id == self.peer_id =>
5657
{
58+
if self.dial_mode != DialMode::Dialing {
59+
// Not my dial
60+
return;
61+
}
5762
self.dial_mode = DialMode::Disconnected;
5863
// For the case that the reason for failure is consistent (e.g the bootstrap peer
5964
// is down), we sleep before redialing

0 commit comments

Comments
 (0)