fix(deno): correctly handle reconnection

This commit is contained in:
alina 🌸 2024-08-21 23:22:20 +03:00
parent 907fe4300e
commit c02b8c5a65
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
2 changed files with 10 additions and 1 deletions

View file

@ -16,6 +16,7 @@ export default antfu({
: true,
yaml: false,
markdown: false,
jsonc: false,
linterOptions: {
reportUnusedDisableDirectives: Boolean(process.env.CI),
},

View file

@ -78,7 +78,15 @@ export abstract class BaseTcpTransport extends EventEmitter implements ITelegram
this.log.info('connection closed')
this._state = TransportState.Idle
this._socket?.close()
try {
this._socket?.close()
} catch (e) {
if (!(e instanceof Deno.errors.BadResource)) {
this.handleError(e)
}
}
this._socket = null
this._currentDc = null
this._packetCodec.reset()