*add calls to this.syncState?.() which may be dynamically set higher in the stack to sync the state of the channels and messages

This commit is contained in:
Derrick Hammer 2023-04-05 03:45:10 -04:00
parent bbe30a3de5
commit 6cb9fd8283
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 0 deletions

View File

@ -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 }) {