From 78e83bbfa93ea7e5d44230bbe50129a0574351b9 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Fri, 13 Jan 2023 13:40:19 +0100 Subject: [PATCH] failing test --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 0cbfdc7..a0b26a3 100644 --- a/index.js +++ b/index.js @@ -489,8 +489,9 @@ module.exports = class Protomux { remoteId = c.uint.decode(state) continue } - state.end = state.start + end + state.end = state.start + len this._decode(remoteId, state) + state.start = state.end state.end = end } } @@ -535,7 +536,8 @@ module.exports = class Protomux { return } - this._remote[rid] = { state, pending: [], session: null } + const copyState = { buffer: state.buffer, start: state.start, end: state.end } + this._remote[rid] = { state: copyState, pending: [], session: null } if (++this._remoteBacklog > MAX_BACKLOG) { throw new Error('Remote exceeded backlog')