-
Notifications
You must be signed in to change notification settings - Fork 93
READY | alleviating browser throttling on WebRTC transport #145
Conversation
Looks like there's a race condition when ending the stream. |
@pgte Thanks for the The tests are passing locally just fine. let me know there are any edits required 😄 |
BTW. the tests are passing successfully on my machine, I reckon it has to do with the |
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.
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.
other than preventing the double callbacks, this looks good to me.
const block = new BlockStream(this.blockStreamSize, {nopad: true}) | ||
|
||
pump(channel, block, channel, (err) => { | ||
if (err) return callback(err) |
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.
I see a possible double-callback here when an error occurs. Maybe use the once
package to make sure you only call the callback once?
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.
@pgte , once is already used few lines before https://github.com/libp2p/js-libp2p-webrtc-star/pull/145/files/1b0d1ed130d6d447c3d0fc54b0abee13fdde11e7#diff-1fdf421c05c1140f6d71444ea2b27638R62
callback = callback ? once(callback) : noop
// ....
// ....
const block = new BlockStream(this.blockStreamSize, {nopad: true})
pump(channel, block, channel, (err) => {
if (err) return callback(err)
})
Does that cover it or am i missing something here ?
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.
Ha, it is, I missed it, sorry. Looks good to me!
const block = new BlockStream(this.blockStreamSize, {nopad: true}) | ||
|
||
pump(channel, block, channel, (err) => { | ||
if (err) return callback(err) |
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.
same here
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.
nvm
I edited the commit msgs that weren't standard. so I had to |
This PR is related to ipfs/js-ipfs#1019 and ipfs/js-ipfs-bitswap#152 , it basically implements
MAX_MESSAGE_SIZE
on the webRTC transport to avoid being throttled by the browser.however as you can see, it fails one of the tests. I would appreciate some help in debugging this since It's been frustrating.
I've tried to use
pull-block
but it didn't work (check the commented out code indial
)note this also still requires some clean-up as you might have noticed 😄
cc. @diasdavid