-
-
Notifications
You must be signed in to change notification settings - Fork 972
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
Fix bug with wrtc not handling Buffers correctly #61
Conversation
Add a line to test/common that exports a WebRTC implementation
Always convert a Buffer to UInt8Array, even if it's a typed array
...to make sure that we're not accidentally null-terminating our messages
I tested this locally against Chrome 47 and Firefox 43 on OSX, and it passed. |
The commits to add zeroes the binary test and make the tests easier to run on node are fine. But the core of the PR, I'm not sure about. This will cause an extra copy on every send, even in non-wrtc situations, which is likely to have performance implications. |
Oh, I see. Yeah, that seems like it could be bad. Would you be opposed to code that special-cases wrtc and only converts from a Buffer in that case? Or, is there some way to convert data from a Buffer without doing a copy? Another solution might be a simple polyfill library that tries to abstract away some of this stuff. |
I think a bit of code that special cases There's no real way to solve this for |
Also, automatically run tests w/ wrtc if it is present
All right, here's a commit that special-cases wrtc. I think there are probably a million ways to do this, so I'm happy to change this if there's a better way. |
Thanks for updating your PR. I think I found a cleaner way to do this for now. Let's just use the existence of the Once another viable alternative exists in node, or the issue is fixed in Published as 5.11.9. |
Awesome! |
In this pull request, I also added back in the
wrtc: wrtc
arguments in the tests, which I see that you recently removed. If you want those to stay out, I can remove that commit from this PR.