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

[AutoNAT client] Refactor how we manage AutoNAT server addresses #809

Open
aarshkshah1992 opened this issue Feb 27, 2020 · 1 comment
Open

Comments

@aarshkshah1992
Copy link
Contributor

aarshkshah1992 commented Feb 27, 2020

Please see libp2p/go-libp2p-autonat#40 for the motivation.
When an AutoNAT client makes a connection with an AutoNAT server, it caches the server address to prevent losing it due to a disconnection. This is messy, causes memory leaks(libp2p/go-libp2p-autonat#9) & prevents us from discovering AutoNAT servers we were connected to before we started the AutoNAT client(libp2p/go-libp2p-autonat#28). There should be a better way to do this.

Once we have #801 in place, we have a way to proactively request the peerstore to keep peer addresses around even after the peer disconnects. We should leverage this. A rough design would be:

  • Subscribe to the EvtPeerIdentificationCompleted message on the Eventbus & if a peer supports the AutoNAT protocol, note down it's peerId so we can keep pinning it till we get an error while trying to probe it. Once we get a dial error, we remove the peerId from our cache & Unpin it.
  • When we want to dial to an AutoNAT server, we use our cached peerIDs to ask the peer store for addresses we can dial to. The metric to shortlist the peers needs to be discussed i.e. most recently seen peers, peers that are still connected etc.
@aarshkshah1992
Copy link
Contributor Author

ping @raulk @Stebalien @willscott .

@Stebalien Stebalien removed the feature label Mar 27, 2021
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

2 participants