-
Notifications
You must be signed in to change notification settings - Fork 224
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
fix(iroh-p2p
): implement full local lookup
#537
Conversation
We were previously only returning the peer id, external addrs, and listening addrs. We now return the same content as performing a lookup on a remote peer.
fn poll( | ||
&mut self, | ||
_cx: &mut Context<'_>, | ||
_params: &mut impl PollParameters, | ||
params: &mut impl PollParameters, | ||
) -> Poll<NetworkBehaviourAction<Self::OutEvent, Self::ConnectionHandler>> { | ||
// TODO(ramfox): | ||
// We can only get the supported protocols of the local node by examining the | ||
// `PollParameters`, which mean you can only get the supported protocols by examining the | ||
// `PollParameters` in this method (`poll`) of a network behaviour. | ||
// I injected this responsibility in the `peer_manager`, because it's the only "simple" | ||
// network behaviour we have implemented. | ||
// There is an issue up to remove `PollParameters`, and a discussion into how to instead | ||
// get the `supported_protocols` of the node: | ||
// https://github.com/libp2p/rust-libp2p/issues/3124 | ||
// When that is resolved, we can hopefully remove this responsibility from the `peer_manager`, | ||
// where it, frankly, doesn't belong. | ||
if self.supported_protocols.is_empty() { | ||
self.supported_protocols = params | ||
.supported_protocols() | ||
.map(|p| String::from_utf8_lossy(&p).to_string()) | ||
.collect(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dignifiedquire would specifically like your eyes on this.
I gave some rationale as to why this is how I decided to proceed, but I'm aware this is an inelegant solution to an inelegant problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems fine to me, we can just update this code once libp2p provides a better method
We were previously only returning the peer id, external addrs, and listening addrs. We now return the same content as performing a lookup on a remote peer.
We were previously only returning the peer id, external addrs, and listening addrs. We now return the same content as performing a lookup on a remote peer.
closes n0-computer/beetle#70