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

Instantiate transports with a reference to node #363

Merged
merged 3 commits into from
May 17, 2019
Merged

Instantiate transports with a reference to node #363

merged 3 commits into from
May 17, 2019

Conversation

guysv
Copy link
Contributor

@guysv guysv commented May 16, 2019

As discussed here, transports could benefit from having a reference to the libp2p node on creation (in case the transport depends on perior connections, e.g. webrtc, relay).

As far as I can tell, this change is backwards compatible.

src/index.js Outdated
@@ -345,7 +345,7 @@ class Node extends EventEmitter {
let t

if (typeof Transport === 'function') {
t = new Transport()
t = new Transport({libp2p: this})
Copy link
Contributor

Choose a reason for hiding this comment

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

Linting fix:

Suggested change
t = new Transport({libp2p: this})
t = new Transport({ libp2p: this })

Copy link
Contributor

Choose a reason for hiding this comment

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

Other than the linting issue this looks fine. Travis is failing due to this and commitlint. I went ahead and disabled commitlint on master so it doesn't block tests going forward. If you rebase master and fix the linting issue I suggested above, travis tests should properly run.

I'll update the commit message on squash/merge.

@guysv
Copy link
Contributor Author

guysv commented May 17, 2019

+bundlesize: { maxSize: '222kB' },
-bundlesize: { maxSize: '218kB' },

?

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.

I'll look into the bundlesize thing separately, that doesn't make any sense and it shouldn't be blocking Travis builds like that.

@jacobheun jacobheun merged commit b06ca1b into libp2p:master May 17, 2019
@guysv guysv deleted the pass-node-to-transports branch May 17, 2019 18:39
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