This commit is contained in:
Miroslav Šedivý 2022-03-10 20:44:23 +01:00
parent 30952b8222
commit 134db3d0c9

View File

@ -78,7 +78,7 @@ export class Reconnector extends EventEmitter<ReconnectorEvents> {
// register connect and disconnect handlers with current class // register connect and disconnect handlers with current class
// as 'this' context, store them to a variable so that they // as 'this' context, store them to a variable so that they
// can be later unregistered // can be later unregistered
this._onConnectHandle = this.onConnect.bind(this) this._onConnectHandle = this.onConnect.bind(this)
this._conn.on('connect', this._onConnectHandle) this._conn.on('connect', this._onConnectHandle)
@ -111,7 +111,7 @@ export class Reconnector extends EventEmitter<ReconnectorEvents> {
private onDisconnect() { private onDisconnect() {
this.clearTimeout() this.clearTimeout()
// only if connection is open, fire disconnect event // only if connection is open, fire disconnect event
// and start reconnecteing logic // and start reconnecteing logic
if (this._open) { if (this._open) {
this.emit('disconnect') this.emit('disconnect')
@ -174,7 +174,7 @@ export class Reconnector extends EventEmitter<ReconnectorEvents> {
// assuming close event can fire multiple times, the same // assuming close event can fire multiple times, the same
// precautions need to be taken as in open event, so that // precautions need to be taken as in open event, so that
// close event fires only once // close event fires only once
if (this._open) { if (this._open) {
this._open = false this._open = false
this._last_connected = undefined this._last_connected = undefined