fix(core): even more graceful close

This commit is contained in:
alina 🌸 2024-06-14 00:45:40 +03:00
parent bbb8d4b908
commit 81f8ea9fd2
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
2 changed files with 2 additions and 1 deletions

View file

@ -308,7 +308,7 @@ export class MtClient extends EventEmitter {
emitError(err: unknown): void {
if (this._emitError) {
this._emitError(err)
} else {
} else if (this._connect.finished()) {
this.log.error('unhandled error:', err)
}
}

View file

@ -879,6 +879,7 @@ export class NetworkManager {
for (const dc of this._dcConnections.values()) {
await dc.destroy()
}
this._dcConnections.clear()
this.config.offReload(this._onConfigChanged)
this._resetOnNetworkChange?.()
}