fix(deno): correctly handle reconnection
This commit is contained in:
parent
907fe4300e
commit
c02b8c5a65
2 changed files with 10 additions and 1 deletions
|
@ -16,6 +16,7 @@ export default antfu({
|
||||||
: true,
|
: true,
|
||||||
yaml: false,
|
yaml: false,
|
||||||
markdown: false,
|
markdown: false,
|
||||||
|
jsonc: false,
|
||||||
linterOptions: {
|
linterOptions: {
|
||||||
reportUnusedDisableDirectives: Boolean(process.env.CI),
|
reportUnusedDisableDirectives: Boolean(process.env.CI),
|
||||||
},
|
},
|
||||||
|
|
|
@ -78,7 +78,15 @@ export abstract class BaseTcpTransport extends EventEmitter implements ITelegram
|
||||||
this.log.info('connection closed')
|
this.log.info('connection closed')
|
||||||
|
|
||||||
this._state = TransportState.Idle
|
this._state = TransportState.Idle
|
||||||
|
|
||||||
|
try {
|
||||||
this._socket?.close()
|
this._socket?.close()
|
||||||
|
} catch (e) {
|
||||||
|
if (!(e instanceof Deno.errors.BadResource)) {
|
||||||
|
this.handleError(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this._socket = null
|
this._socket = null
|
||||||
this._currentDc = null
|
this._currentDc = null
|
||||||
this._packetCodec.reset()
|
this._packetCodec.reset()
|
||||||
|
|
Loading…
Reference in a new issue