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

LocalPeers needs to handle multiple connections per device #374

Closed
gmaclennan opened this issue Nov 13, 2023 · 0 comments · Fixed by #378
Closed

LocalPeers needs to handle multiple connections per device #374

gmaclennan opened this issue Nov 13, 2023 · 0 comments · Fixed by #378
Assignees

Comments

@gmaclennan
Copy link
Member

Description

Work on end-to-end tests revealed a bug in how LocalPeers works. The class indexes peers by peerId (the device ID of the peer), but it's possible to have more than one connection to a peer. This happens when both peers try to connect to each other at the same time. LocalDiscovery will de-duplicate these connections, deterministically closing one of them, but LocalPeers only keeps a reference to one of the connections (because it only support one connection per device), which can be the closed "deduplicated" connection.

LocalPeers needs an internal refactor to handle multiple connections per peer, intelligently select the best connection to use for sending RPC messages, and to abstract some of the complexity of duplicate connections when emitting peers, e.g. only emitting the open connection.

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 a pull request may close this issue.

1 participant