Compare commits

..

No commits in common. "54904ab1ade4abcd867b9d97b5b78e6ee5bd79a6" and "2b645af1e93a5fa071727f226940bc4a1122eca3" have entirely different histories.

1 changed files with 7 additions and 11 deletions

View File

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