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

feat: coalescing dial support #518

Merged
merged 11 commits into from
Dec 15, 2019
Merged

Conversation

jacobheun
Copy link
Contributor

  • Parallel dials to the same peer / multiaddr will now settle at the same time with the same result
  • Removed connectToMultiaddr, all dials now go directly through connectToPeer
  • Fixed an issue with closed inbound connections not getting removed from tracking
  • PeerStore.put now allows you to update a peer without firing the peer event. This helps prevent duplicate dialing when dialing a new multiaddr directly. (For example: ipfs swarm connect [addr])

Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is in a good direction. Just found something that I did not understand

src/dialer/index.js Outdated Show resolved Hide resolved
Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🎉

Only, left a small suggestion for code readability

* @return {PeerInfo}
*/
put (peerInfo) {
put (peerInfo, silent = false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think on transforming silent in an object? I think it helps to understand in the peerStore.put(peerInfo, true) what the true is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, I refactored and pushed a change to make it take an options object.

@jacobheun jacobheun merged commit 4a871bb into refactor/async-await Dec 15, 2019
@jacobheun jacobheun deleted the feat/dial-coalescing branch December 15, 2019 16:33
jacobheun added a commit that referenced this pull request Jan 24, 2020
* docs: fix spelling in api

* fix: dont create peerstore twice

* feat: add support for dial coalescing

* doc(fix): add setPeerValue to API TOC

* docs: add more jsdocs to dialer

* chore: remove old comment

* fix: ensure connections are closed

* fix: registrar.getConnections returns first open conn

* fix: directly set the closed status

* chore: remove unneeded log

* refactor: peerStore.put takes an options object
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