diff --git a/eslint.config.js b/eslint.config.js index f04db009..6ba8b445 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -16,6 +16,7 @@ export default antfu({ : true, yaml: false, markdown: false, + jsonc: false, linterOptions: { reportUnusedDisableDirectives: Boolean(process.env.CI), }, diff --git a/packages/deno/src/utils/tcp.ts b/packages/deno/src/utils/tcp.ts index 0695aed5..88727b13 100644 --- a/packages/deno/src/utils/tcp.ts +++ b/packages/deno/src/utils/tcp.ts @@ -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()