fix: correctly reset session
This commit is contained in:
parent
d577f0ed9b
commit
fa267eef03
3 changed files with 3 additions and 3 deletions
|
@ -79,12 +79,12 @@ export abstract class BaseTcpTransport extends EventEmitter implements ITelegram
|
||||||
if (this._state === TransportState.Idle) return
|
if (this._state === TransportState.Idle) return
|
||||||
this.log.info('connection closed')
|
this.log.info('connection closed')
|
||||||
|
|
||||||
this.emit('close')
|
|
||||||
this._state = TransportState.Idle
|
this._state = TransportState.Idle
|
||||||
this._socket?.end()
|
this._socket?.end()
|
||||||
this._socket = null
|
this._socket = null
|
||||||
this._currentDc = null
|
this._currentDc = null
|
||||||
this._packetCodec.reset()
|
this._packetCodec.reset()
|
||||||
|
this.emit('close')
|
||||||
}
|
}
|
||||||
|
|
||||||
handleError(socket: unknown, error: Error): void {
|
handleError(socket: unknown, error: Error): void {
|
||||||
|
|
|
@ -73,13 +73,13 @@ export abstract class BaseTcpTransport extends EventEmitter implements ITelegram
|
||||||
if (this._state === TransportState.Idle) return
|
if (this._state === TransportState.Idle) return
|
||||||
this.log.info('connection closed')
|
this.log.info('connection closed')
|
||||||
|
|
||||||
this.emit('close')
|
|
||||||
this._state = TransportState.Idle
|
this._state = TransportState.Idle
|
||||||
this._socket!.removeAllListeners()
|
this._socket!.removeAllListeners()
|
||||||
this._socket!.destroy()
|
this._socket!.destroy()
|
||||||
this._socket = null
|
this._socket = null
|
||||||
this._currentDc = null
|
this._currentDc = null
|
||||||
this._packetCodec.reset()
|
this._packetCodec.reset()
|
||||||
|
this.emit('close')
|
||||||
}
|
}
|
||||||
|
|
||||||
handleError(error: Error): void {
|
handleError(error: Error): void {
|
||||||
|
|
|
@ -130,13 +130,13 @@ export abstract class BaseWebSocketTransport extends EventEmitter implements ITe
|
||||||
if (this._state === TransportState.Idle) return
|
if (this._state === TransportState.Idle) return
|
||||||
this.log.info('connection closed')
|
this.log.info('connection closed')
|
||||||
|
|
||||||
this.emit('close')
|
|
||||||
this._state = TransportState.Idle
|
this._state = TransportState.Idle
|
||||||
this._socket!.removeEventListener('close', this.close)
|
this._socket!.removeEventListener('close', this.close)
|
||||||
this._socket!.close()
|
this._socket!.close()
|
||||||
this._socket = null
|
this._socket = null
|
||||||
this._currentDc = null
|
this._currentDc = null
|
||||||
this._packetCodec.reset()
|
this._packetCodec.reset()
|
||||||
|
this.emit('close')
|
||||||
}
|
}
|
||||||
|
|
||||||
handleError(event: Event | { error: Error }): void {
|
handleError(event: Event | { error: Error }): void {
|
||||||
|
|
Loading…
Reference in a new issue