further fixes for #210

This commit is contained in:
Dave Horton
2023-01-07 14:49:59 -05:00
parent 0f6b7e860d
commit 38185426e2
2 changed files with 11 additions and 5 deletions

View File

@@ -82,12 +82,18 @@ class CallSession extends Emitter {
this._pool = srf.locals.dbHelpers.pool;
const handover = (newRequestor) => {
this.logger.info(`handover to new base url ${newRequestor.url}`);
this.requestor.removeAllListeners();
this.application.requestor = newRequestor;
this.requestor.on('command', this._onCommand.bind(this));
this.requestor.on('connection-dropped', this._onWsConnectionDropped.bind(this));
this.requestor.on('handover', handover.bind(this));
};
this.requestor.on('command', this._onCommand.bind(this));
this.requestor.on('connection-dropped', this._onWsConnectionDropped.bind(this));
this.requestor.on('handover', (newRequestor) => {
this.logger.info(`handover to new base url ${newRequestor.url}`);
this.application.requestor = newRequestor;
});
this.requestor.on('handover', handover.bind(this));
}
/**

View File

@@ -101,7 +101,7 @@ class HttpRequestor extends BaseRequestor {
this.close();
this.emit('handover', requestor);
}
return requestor.request(type, hook, params, httpHeaders);
return requestor.request('session:new', hook, params, httpHeaders);
}
let newClient;