Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swarm: Add ExpandedSwarm::is_connected #1862

Merged
merged 2 commits into from
Nov 26, 2020
Merged

Conversation

mxinden
Copy link
Member

@mxinden mxinden commented Nov 26, 2020

Commit 335e55e removed the ConnectionInfo trait in favor of PeerIds. Commit
1bd013c removed ExpandedSwarm::connection_info as it would only return the
PeerId that the caller is already aware of.

One could use ExpandedSwarm::connection_info not only to retrieve the
ConnectionInfo for a given peer, but also to check whether the underlying
Network has a connection to the peer.

This commit exposes the is_connected method on Network via ExpandedSwarm
to check whether the Network has an established connection to a given peer.


One could as well expose other read-only methods on Network like is_dialing
and is_disconnected. For now this pull request only restores the status-quo.
Let me know what you prefer.

Commit 335e55e removed the `ConnectionInfo` trait in favor of
`PeerId`s. Commit 1bd013c removed `ExpandedSwarm::connection_info` as
it would only return the `PeerId` that the caller is already aware of.

One could use `ExpandedSwarm::connection_info` not only to retrieve the
`ConnectionInfo` for a given peer, but also to check whether the
underlying `Network` has a connection to the peer.

This commit exposes the `is_connected` method on `Network` via
`ExpandedSwarm` to check whether the `Network` has an established
connection to a given peer.
@mxinden mxinden merged commit dae07b0 into libp2p:master Nov 26, 2020
@mxinden
Copy link
Member Author

mxinden commented Nov 26, 2020

Release tagged and published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants