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: discovery modules from transports should be added #510

Conversation

vasco-santos
Copy link
Member

Discovery modules within Transports automatically added to discovery if enabled

@vasco-santos vasco-santos force-pushed the feat/discovery-modules-from-transports-should-be-enabled branch from 78040ca to 7f216a9 Compare December 11, 2019 15:10
doc/CONFIGURATION.md Outdated Show resolved Hide resolved
src/index.js Outdated
@@ -448,7 +448,8 @@ class Libp2p extends EventEmitter {
config = { ...config, ...this._config.peerDiscovery[DiscoveryService.tag] }
}

if (config.enabled) {
if (config.enabled &&
!this._discovery.filter((service) => service.tag === DiscoveryService.tag).length) { // not already added
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we just make this._discovery a Map? They require a tag, it might be easier for checking existence and getting specific ones should we need to do that.


await libp2p.start()

expect(libp2p._discovery).to.have.lengthOf(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should verify this is the discovery service we expect. Making libp2p. _discovery a map would make this easy to do.

vasco-santos and others added 2 commits December 11, 2019 16:21
Co-Authored-By: Jacob Heun <jacobheun@gmail.com>
Copy link
Contributor

@jacobheun jacobheun left a comment

Choose a reason for hiding this comment

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

One minor thing, otherwise this is gtg! 🎉

src/index.js Outdated Show resolved Hide resolved
Co-Authored-By: Jacob Heun <jacobheun@gmail.com>
@jacobheun jacobheun merged commit 1ee1787 into refactor/async-await Dec 11, 2019
@jacobheun jacobheun deleted the feat/discovery-modules-from-transports-should-be-enabled branch December 11, 2019 16:06
jacobheun added a commit that referenced this pull request Dec 12, 2019
* feat: discovery modules from transports should be added

* chore: apply suggestions from code review

Co-Authored-By: Jacob Heun <jacobheun@gmail.com>

* chore: address review

* chore: apply suggestions from code review

Co-Authored-By: Jacob Heun <jacobheun@gmail.com>
jacobheun added a commit that referenced this pull request Jan 24, 2020
* feat: discovery modules from transports should be added

* chore: apply suggestions from code review

Co-Authored-By: Jacob Heun <jacobheun@gmail.com>

* chore: address review

* chore: apply suggestions from code review

Co-Authored-By: Jacob Heun <jacobheun@gmail.com>
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