fix: patch protomux to use the buffers arraybuffer byteLength

This commit is contained in:
Derrick Hammer 2023-07-24 13:30:55 -04:00
parent 12cb3a3b5e
commit dcad699ae1
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,5 @@
diff --git a/node_modules/protomux/index.js b/node_modules/protomux/index.js
index 07bf0ad..c8db59c 100644
index 07bf0ad..ef91c72 100644
--- a/node_modules/protomux/index.js
+++ b/node_modules/protomux/index.js
@@ -195,34 +195,34 @@ class Channel {
@ -9,7 +9,7 @@ index 07bf0ad..c8db59c 100644
- recv (state, session) {
+ async recv (state, session) {
session._track(m.onmessage(encoding.decode(state), session))
},
},
- send (m, session = s) {
+ async send (m, session = s) {
if (session.closed === true) return false
@ -43,3 +43,12 @@ index 07bf0ad..c8db59c 100644
mux.drained = mux.stream.write(state.buffer)
@@ -417,7 +417,7 @@ module.exports = class Protomux {
_ondata (buffer) {
try {
- const state = { buffer, start: 0, end: buffer.byteLength }
+ const state = { buffer, start: 0, end: buffer.buffer.byteLength }
this._decode(c.uint.decode(state), state)
} catch (err) {
this._safeDestroy(err)