_slave is on _mutex on channel

This commit is contained in:
Derrick Hammer 2023-04-06 22:04:27 -04:00
parent 1387b060a4
commit e0178e41ed
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 4 deletions

View File

@ -51,7 +51,7 @@ class Channel {
}
async open(handshake) {
if (this._slave) {
if (this._mux._slave) {
await this._mux.pullLocal();
await this._mux.pullFree();
}
@ -65,7 +65,7 @@ class Channel {
this._localId = id + 1;
this._mux._local[id] = this;
if (this._slave) {
if (this._mux._slave) {
if (freeLen > 0) {
await this._mux.popFree(id);
} else {
@ -153,14 +153,14 @@ class Channel {
if (this._remoteId > 0) {
this._mux._remote[this._remoteId - 1] = null;
this._remoteId = 0;
if (this._slave) {
if (this._mux._slave) {
await this._mux.pullFree();
}
// If remote has acked, we can reuse the local id now
// otherwise, we need to wait for the "ack" to arrive
this._mux._free.push(this._localId - 1);
if (this._slave) {
if (this._mux._slave) {
await this._mux.pushFree(this._localId - 1);
}
}