fix webrtc _connected.

This commit is contained in:
Miroslav Šedivý 2022-02-13 23:30:58 +01:00
parent 53a78140ea
commit e78ee758c5

View File

@ -455,15 +455,13 @@ export class NekoWebRTC extends EventEmitter<NekoWebRTCEvents> {
} }
private onDisconnected(error?: Error) { private onDisconnected(error?: Error) {
const wasConnected = this._connected
this.disconnect() this.disconnect()
if (!this._connected) { if (wasConnected) {
return
}
this._log.info(`disconnected`, { error }) this._log.info(`disconnected`, { error })
this.emit('disconnected', error) this.emit('disconnected', error)
this._connected = false }
} }
private statsEmitter(ms: number = 2000) { private statsEmitter(ms: number = 2000) {