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

refactor(async): add dialer and upgrader #462

Merged
merged 19 commits into from
Oct 21, 2019

Conversation

jacobheun
Copy link
Contributor

@jacobheun jacobheun commented Oct 2, 2019

This PR adds Dialer and Upgrader components. This moves away from the convoluted connection upgrade process the Switch goes through now, by leveraging a Dialer and Upgrader. An Upgrader takes a MultiaddrConnection and goes through the process of upgrading it into a libp2p connection. This upgrade process will include things like crypto and muxer selection.

The Dialer will:

  • Allow dialing a single address (new!) Dialing a multiaddr should dial it first #451
  • Allow dialing to a peer on any of its addresses
  • Allow for parallel dials with abort support (new!) This has the potential to introduce the simultaneous dial problem that go libp2p currently has if nodes don't abort the same connections, so I'm punting on this for a future PR

@jacobheun jacobheun marked this pull request as ready for review October 18, 2019 11:21
@jacobheun jacobheun changed the title [WIP] refactor(async): add dialer and upgrader refactor(async): add dialer and upgrader Oct 18, 2019
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.

Awesome! This new version is way cleaner 😃

Request some minor changes in the code. I did not look at the tests in this round

src/dialer.js Outdated Show resolved Hide resolved
src/dialer.js Outdated Show resolved Hide resolved
src/dialer.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
test/utils/mockMultiaddrConn.js Outdated Show resolved Hide resolved
src/upgrader.js Show resolved Hide resolved
src/upgrader.js Show resolved Hide resolved
src/upgrader.js Outdated Show resolved Hide resolved
src/upgrader.js Outdated Show resolved Hide resolved
src/upgrader.js Outdated Show resolved Hide resolved
@jacobheun
Copy link
Contributor Author

jacobheun commented Oct 21, 2019

Since libp2p-interfaces has been released, I also switched out interface-connection for that.

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.

🎉

@jacobheun jacobheun merged commit a23d4d2 into refactor/async-await Oct 21, 2019
@jacobheun jacobheun deleted the refactor/dialer branch October 21, 2019 14:54
dirkmc pushed a commit that referenced this pull request Nov 26, 2019
* chore(deps): update connection and multistream

* feat: add basic dial support for addresses and peers

* test: automatically require all node test files

* fix: dont catch and log in the wrong place

* test: add direct spec test

fix: improve dial error consistency

* feat: add dial timeouts and concurrency

Queue timeouts will result in aborts of the dials

* chore: fix linting

* test: verify dialer defaults

* feat: add initial upgrader

* fix: add more test coverage and fix bugs

* feat: libp2p creates the upgrader

* feat: hook up handle to the upgrader

* feat: hook up the dialer to libp2p

test: add node dialer libp2p tests

* feat: add connection listeners to upgrader

* feat: emit connect and disconnect events

* chore: use libp2p-interfaces

* fix: address review feedback

* fix: correct import

* refactor: dedupe connection creation code
dirkmc pushed a commit that referenced this pull request Nov 26, 2019
* chore(deps): update connection and multistream

* feat: add basic dial support for addresses and peers

* test: automatically require all node test files

* fix: dont catch and log in the wrong place

* test: add direct spec test

fix: improve dial error consistency

* feat: add dial timeouts and concurrency

Queue timeouts will result in aborts of the dials

* chore: fix linting

* test: verify dialer defaults

* feat: add initial upgrader

* fix: add more test coverage and fix bugs

* feat: libp2p creates the upgrader

* feat: hook up handle to the upgrader

* feat: hook up the dialer to libp2p

test: add node dialer libp2p tests

* feat: add connection listeners to upgrader

* feat: emit connect and disconnect events

* chore: use libp2p-interfaces

* fix: address review feedback

* fix: correct import

* refactor: dedupe connection creation code
jacobheun added a commit that referenced this pull request Dec 12, 2019
* chore(deps): update connection and multistream

* feat: add basic dial support for addresses and peers

* test: automatically require all node test files

* fix: dont catch and log in the wrong place

* test: add direct spec test

fix: improve dial error consistency

* feat: add dial timeouts and concurrency

Queue timeouts will result in aborts of the dials

* chore: fix linting

* test: verify dialer defaults

* feat: add initial upgrader

* fix: add more test coverage and fix bugs

* feat: libp2p creates the upgrader

* feat: hook up handle to the upgrader

* feat: hook up the dialer to libp2p

test: add node dialer libp2p tests

* feat: add connection listeners to upgrader

* feat: emit connect and disconnect events

* chore: use libp2p-interfaces

* fix: address review feedback

* fix: correct import

* refactor: dedupe connection creation code
jacobheun added a commit that referenced this pull request Jan 24, 2020
* chore(deps): update connection and multistream

* feat: add basic dial support for addresses and peers

* test: automatically require all node test files

* fix: dont catch and log in the wrong place

* test: add direct spec test

fix: improve dial error consistency

* feat: add dial timeouts and concurrency

Queue timeouts will result in aborts of the dials

* chore: fix linting

* test: verify dialer defaults

* feat: add initial upgrader

* fix: add more test coverage and fix bugs

* feat: libp2p creates the upgrader

* feat: hook up handle to the upgrader

* feat: hook up the dialer to libp2p

test: add node dialer libp2p tests

* feat: add connection listeners to upgrader

* feat: emit connect and disconnect events

* chore: use libp2p-interfaces

* fix: address review feedback

* fix: correct import

* refactor: dedupe connection creation code
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