From 6cb9fd82833e8c9577af92161ff7f49c10e3c509 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 5 Apr 2023 03:45:10 -0400 Subject: [PATCH] *add calls to this.syncState?.() which may be dynamically set higher in the stack to sync the state of the channels and messages --- index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.js b/index.js index 70f6648..1c4638e 100644 --- a/index.js +++ b/index.js @@ -81,6 +81,7 @@ class Channel { if (this._handshake) this._handshake.encode(state, handshake); this._mux._write0(state.buffer); + this.syncState?.(); } _dec() { @@ -95,6 +96,7 @@ class Channel { _fullyOpenSoon() { this._mux._remote[this._remoteId - 1].session = this; queueTick(this._fullyOpen.bind(this)); + this.syncState?.(); } _fullyOpen() { @@ -152,6 +154,7 @@ class Channel { this._track(this.onclose(isRemote, this)); if (this._active === 0) this._destroy(); + this.syncState?.(); } _destroy() { @@ -509,6 +512,7 @@ module.exports = class Protomux { return; } + this.syncState?.(); r.session._recv(type, state); } @@ -530,6 +534,8 @@ module.exports = class Protomux { this._onclosesession(state); break; } + + this.syncState?.(); } _bufferMessage(r, type, { buffer, start, end }) {