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

p2p: Keep track of connected peers #16

Closed
haardikk21 opened this issue Feb 21, 2024 · 1 comment
Closed

p2p: Keep track of connected peers #16

haardikk21 opened this issue Feb 21, 2024 · 1 comment

Comments

@haardikk21
Copy link
Contributor

Unlike libp2p-js, Rust libp2p does not keep track of peers we have connected to (actually, it only keeps the PeerId, but not the MultiAddr - and the PeerId by itself is pretty useless).

The goal of keeping track of connected peers is that during the peer discovery process, it is likely we will get the contact information of a hub we are already connected to at some point. Currently, this mistakenly leads Teleport to establish a second (or third, or fourth..) connection to the same Hub - which doesn't end well.

Additionally, during peer discovery, we only receive the other peer's external address - not their PeerId - hence the need to keep track of MultiAddr of peers we are already connected to.

File that will need changes: lib/hub/src/p2p/event_loop.rs
fn peer_discovery_response has a TODO marked where this needs to happen.

@haardikk21
Copy link
Contributor Author

DO NOT DO.

This turns out to be irrelevant because of #17

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

No branches or pull requests

1 participant