mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-04-25 11:02:12 +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:
parent
8aeb7b3db0
commit
ab6fecd9f3
@ -3,6 +3,9 @@
|
|||||||
- Make `OneShotHandler`s `max_dial_negotiate` limit configurable.
|
- Make `OneShotHandler`s `max_dial_negotiate` limit configurable.
|
||||||
[PR 1936](https://github.com/libp2p/rust-libp2p/pull/1936).
|
[PR 1936](https://github.com/libp2p/rust-libp2p/pull/1936).
|
||||||
|
|
||||||
|
- Fix handling of DialPeerCondition::Always.
|
||||||
|
[PR 1937](https://github.com/libp2p/rust-libp2p/pull/1937).
|
||||||
|
|
||||||
# 0.27.0 [2021-01-12]
|
# 0.27.0 [2021-01-12]
|
||||||
|
|
||||||
- Update dependencies.
|
- Update dependencies.
|
||||||
|
@ -691,11 +691,9 @@ where TBehaviour: NetworkBehaviour<ProtocolsHandler = THandler>,
|
|||||||
this.behaviour.inject_dial_failure(&peer_id);
|
this.behaviour.inject_dial_failure(&peer_id);
|
||||||
} else {
|
} else {
|
||||||
let condition_matched = match condition {
|
let condition_matched = match condition {
|
||||||
DialPeerCondition::Disconnected
|
DialPeerCondition::Disconnected => this.network.is_disconnected(&peer_id),
|
||||||
if this.network.is_disconnected(&peer_id) => true,
|
DialPeerCondition::NotDialing => !this.network.is_dialing(&peer_id),
|
||||||
DialPeerCondition::NotDialing
|
DialPeerCondition::Always => true,
|
||||||
if !this.network.is_dialing(&peer_id) => true,
|
|
||||||
_ => false
|
|
||||||
};
|
};
|
||||||
if condition_matched {
|
if condition_matched {
|
||||||
if ExpandedSwarm::dial(this, &peer_id).is_ok() {
|
if ExpandedSwarm::dial(this, &peer_id).is_ok() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user