Compare commits
2 Commits
2b645af1e9
...
54904ab1ad
Author | SHA1 | Date |
---|---|---|
Derrick Hammer | 54904ab1ad | |
Derrick Hammer | ab4632b644 |
18
index.js
18
index.js
|
@ -605,14 +605,14 @@ module.exports = class Protomux {
|
|||
const info = this._get(protocol, id);
|
||||
|
||||
if (this._slave) {
|
||||
await this._mux.pullRemote();
|
||||
await this.pullRemote();
|
||||
}
|
||||
|
||||
// allow the remote to grow the ids by one
|
||||
if (this._remote.length === rid) {
|
||||
this._remote.push(null);
|
||||
if (this._slave) {
|
||||
await this._mux.pushRemote(this._remote.length - 1);
|
||||
await this.pushRemote(this._remote.length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -626,18 +626,22 @@ module.exports = class Protomux {
|
|||
|
||||
if (session === null) {
|
||||
if (this._slave) {
|
||||
await this._mux.pullFree();
|
||||
await this.pullFree();
|
||||
}
|
||||
// we already closed the channel - ignore
|
||||
this._free.push(localId - 1);
|
||||
if (this._slave) {
|
||||
await this._mux.pushFree(localId - 1);
|
||||
await this.pushFree(localId - 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this._remote[rid] = { state, pending: null, session: null };
|
||||
|
||||
if (this._slave) {
|
||||
await this.pushRemote(remoteId);
|
||||
}
|
||||
|
||||
session._remoteId = remoteId;
|
||||
session._fullyOpen();
|
||||
return;
|
||||
|
@ -658,7 +662,7 @@ module.exports = class Protomux {
|
|||
info.incoming.push(remoteId);
|
||||
|
||||
if (this._slave) {
|
||||
await this._mux.pushRemotes();
|
||||
await this.pushRemote(remoteId);
|
||||
}
|
||||
|
||||
this._requestSession(protocol, id, info).catch(this._safeDestroyBound);
|
||||
|
@ -677,12 +681,12 @@ module.exports = class Protomux {
|
|||
const session = this._local[localId - 1];
|
||||
|
||||
if (this._slave) {
|
||||
await this._mux.pullFree(localId - 1);
|
||||
await this.pullFree(localId - 1);
|
||||
}
|
||||
|
||||
this._free.push(localId - 1);
|
||||
if (this._slave) {
|
||||
await this._mux.pushFree(localId - 1);
|
||||
await this.pushFree(localId - 1);
|
||||
}
|
||||
|
||||
if (session !== null) session._close(true);
|
||||
|
|
Reference in New Issue