*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:
parent
bbe30a3de5
commit
6cb9fd8283
6
index.js
6
index.js
|
@ -81,6 +81,7 @@ class Channel {
|
||||||
if (this._handshake) this._handshake.encode(state, handshake);
|
if (this._handshake) this._handshake.encode(state, handshake);
|
||||||
|
|
||||||
this._mux._write0(state.buffer);
|
this._mux._write0(state.buffer);
|
||||||
|
this.syncState?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
_dec() {
|
_dec() {
|
||||||
|
@ -95,6 +96,7 @@ class Channel {
|
||||||
_fullyOpenSoon() {
|
_fullyOpenSoon() {
|
||||||
this._mux._remote[this._remoteId - 1].session = this;
|
this._mux._remote[this._remoteId - 1].session = this;
|
||||||
queueTick(this._fullyOpen.bind(this));
|
queueTick(this._fullyOpen.bind(this));
|
||||||
|
this.syncState?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
_fullyOpen() {
|
_fullyOpen() {
|
||||||
|
@ -152,6 +154,7 @@ class Channel {
|
||||||
this._track(this.onclose(isRemote, this));
|
this._track(this.onclose(isRemote, this));
|
||||||
|
|
||||||
if (this._active === 0) this._destroy();
|
if (this._active === 0) this._destroy();
|
||||||
|
this.syncState?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
_destroy() {
|
_destroy() {
|
||||||
|
@ -509,6 +512,7 @@ module.exports = class Protomux {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.syncState?.();
|
||||||
r.session._recv(type, state);
|
r.session._recv(type, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -530,6 +534,8 @@ module.exports = class Protomux {
|
||||||
this._onclosesession(state);
|
this._onclosesession(state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.syncState?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
_bufferMessage(r, type, { buffer, start, end }) {
|
_bufferMessage(r, type, { buffer, start, end }) {
|
||||||
|
|
Reference in New Issue