-
Notifications
You must be signed in to change notification settings - Fork 446
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
Make libp2p a state machine #257
Conversation
9b33a31
to
22999a5
Compare
22999a5
to
b6fec69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All in all looks good! Just minor things found
README.md
Outdated
- `callback`: Function with signature `function (err, conn) {}` where `conn` is a [Connection](https://github.com/libp2p/interface-connection) object | ||
|
||
`callback` is a function with the following `function (err, conn) {}` signature, where `err` is an Error in of failure to dial the connection and `conn` is a [Connection][] instance in case of a protocol selected, if not it is undefined. | ||
- `callback` is a function with the following `function (err, conn) {}` signature, where `err` is an Error in of failure to dial the connection and `conn` is a [Connection][] instance in case of a protocol selected, if not it is undefined. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
following signature function (err, conn) {}
seems better
src/index.js
Outdated
* Starts the libp2p node and all sub services | ||
* | ||
* @param {function(Error)} callback | ||
* @fires Node#start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
improper usage of jsdocs @fires
src/index.js
Outdated
* Stop the libp2p node by closing its listeners and open connections | ||
* | ||
* @param {function(Error)} callback | ||
* @fires Node#stop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
improper usage of jsdocs @fires
@vasco-santos I updated callback language in the readme everywhere to reflect the change. I also moved all |
3c98abd
to
10c8390
Compare
Bumps [@multiformats/mafmt](https://github.com/multiformats/js-mafmt) from 11.1.2 to 12.0.0. - [Release notes](https://github.com/multiformats/js-mafmt/releases) - [Changelog](https://github.com/multiformats/js-mafmt/blob/master/CHANGELOG.md) - [Commits](multiformats/js-mafmt@v11.1.2...v12.0.0) --- updated-dependencies: - dependency-name: "@multiformats/mafmt" dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
## [6.1.4](libp2p/js-libp2p-tcp@v6.1.3...v6.1.4) (2023-03-20) ### Dependencies * bump @multiformats/mafmt from 11.1.2 to 12.0.0 ([libp2p#257](libp2p/js-libp2p-tcp#257)) ([2e8e534](libp2p/js-libp2p-tcp@2e8e534))
Updates aegir and removes superfluous typescript dep --------- Co-authored-by: achingbrain <alex@achingbrain.net>
## [7.1.2](libp2p/js-libp2p-mplex@v7.1.1...v7.1.2) (2023-03-21) ### Trivial Changes * replace err-code with CodeError ([libp2p#242](libp2p/js-libp2p-mplex#242)) ([8d58a3b](libp2p/js-libp2p-mplex@8d58a3b)), closes [js-libp2p#1269](libp2p#1269) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([54de88d](libp2p/js-libp2p-mplex@54de88d)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([df03e8d](libp2p/js-libp2p-mplex@df03e8d)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([9c3f235](libp2p/js-libp2p-mplex@9c3f235)) ### Dependencies * **dev:** bump typescript from 4.9.5 to 5.0.2 ([libp2p#256](libp2p/js-libp2p-mplex#256)) ([a3590af](libp2p/js-libp2p-mplex@a3590af)) * **dev:** Upgrade aegir to 38.1.7 ([libp2p#257](libp2p/js-libp2p-mplex#257)) ([e0bf45a](libp2p/js-libp2p-mplex@e0bf45a))
Exposes the new
dialFSM
calls from switch#278, giving libp2p users the option to listen to more detailed information from dials via returned ConnectionFSM's.This also adds state machine logic to libp2p and ensures restarts are idempotent.
Ideally
dialFSM
would return the state machines instead of via callback, but checking the peer data may require an async call to the dht, so the callback logic stays the same.TODO:
Depends on libp2p/js-libp2p-switch#278
Resolves #98