mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-23 23:01:33 +00:00
Fix DialPeerCondition::Always handling (#1937)
* fix: always dial with condition Always * chore: changelog note * refactor: exhaustive DialPeerCondition matching Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
This commit is contained in:
swarm
@ -691,11 +691,9 @@ where TBehaviour: NetworkBehaviour<ProtocolsHandler = THandler>,
|
||||
this.behaviour.inject_dial_failure(&peer_id);
|
||||
} else {
|
||||
let condition_matched = match condition {
|
||||
DialPeerCondition::Disconnected
|
||||
if this.network.is_disconnected(&peer_id) => true,
|
||||
DialPeerCondition::NotDialing
|
||||
if !this.network.is_dialing(&peer_id) => true,
|
||||
_ => false
|
||||
DialPeerCondition::Disconnected => this.network.is_disconnected(&peer_id),
|
||||
DialPeerCondition::NotDialing => !this.network.is_dialing(&peer_id),
|
||||
DialPeerCondition::Always => true,
|
||||
};
|
||||
if condition_matched {
|
||||
if ExpandedSwarm::dial(this, &peer_id).is_ok() {
|
||||
|
Reference in New Issue
Block a user