reconnect: disconnect on destroy.

This commit is contained in:
Miroslav Šedivý 2021-07-26 23:35:19 +02:00
parent 28f256b5b5
commit b8453b3211
3 changed files with 4 additions and 5 deletions

View File

@ -165,6 +165,9 @@ export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
public destroy() {
this._websocket_reconn.destroy()
this._webrtc_reconn.destroy()
Vue.set(this._state, 'type', 'none')
Vue.set(this._state, 'status', 'disconnected')
}
_webrtcQualityDowngrade(quality: string): string | undefined {

View File

@ -173,10 +173,7 @@ export class Reconnector extends EventEmitter<ReconnectorEvents> {
}
public destroy() {
if (this._timeout) {
window.clearTimeout(this._timeout)
this._timeout = undefined
}
this.close()
this._conn.off('connect', this._onConnectHandle)
this._conn.off('disconnect', this._onDisconnectHandle)

View File

@ -412,7 +412,6 @@
beforeDestroy() {
this.observer.disconnect()
this.connection.disconnect()
this.connection.destroy()
this.clear()