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

Make libp2p a state machine #257

Merged
merged 13 commits into from
Oct 19, 2018
Merged

Make libp2p a state machine #257

merged 13 commits into from
Oct 19, 2018

Conversation

jacobheun
Copy link
Contributor

@jacobheun jacobheun commented Oct 5, 2018

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:

  • Update readme with new methods
  • Update switch dependency once it's released

Depends on libp2p/js-libp2p-switch#278
Resolves #98

@ghost ghost assigned jacobheun Oct 5, 2018
@ghost ghost added the status/in-progress In progress label Oct 5, 2018
@jacobheun jacobheun force-pushed the feat/state-machine branch 2 times, most recently from 9b33a31 to 22999a5 Compare October 6, 2018 10:33
@jacobheun jacobheun changed the title [WIP] Feat/state machine Make libp2p a state machine Oct 18, 2018
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.

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.
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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

@jacobheun
Copy link
Contributor Author

@vasco-santos I updated callback language in the readme everywhere to reflect the change. I also moved all @fired jsdocs to the class level and made sure all events are documented there. Thanks for catching those!

maschad pushed a commit to maschad/js-libp2p that referenced this pull request Jun 21, 2023
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>
maschad pushed a commit to maschad/js-libp2p that referenced this pull request Jun 21, 2023
## [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))
maschad added a commit to maschad/js-libp2p that referenced this pull request Jun 21, 2023
Updates aegir and removes superfluous typescript dep

---------

Co-authored-by: achingbrain <alex@achingbrain.net>
maschad pushed a commit to maschad/js-libp2p that referenced this pull request Jun 21, 2023
## [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))
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