From f559bd1ba45fd726e70b30ce6743f19d1f44bd9a Mon Sep 17 00:00:00 2001 From: paweldomas Date: Tue, 25 Aug 2015 12:14:09 +0200 Subject: [PATCH] CONNECTION_INTERRUPTED event will now be generated if we've ever been in stable state(we can go into "unstable" state after muting video and connection problems screen will not be displayed). --- modules/xmpp/JingleSessionPC.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/xmpp/JingleSessionPC.js b/modules/xmpp/JingleSessionPC.js index 370a4e600..5fc78bfe6 100644 --- a/modules/xmpp/JingleSessionPC.js +++ b/modules/xmpp/JingleSessionPC.js @@ -83,7 +83,10 @@ JingleSessionPC.prototype.doInitialize = function () { this.hadstuncandidate = false; this.hadturncandidate = false; this.lasticecandidate = false; + // True if reconnect is in progress this.isreconnect = false; + // Set to true if the connection was ever stable + this.wasstable = false; this.peerconnection = new TraceablePeerConnection( this.connection.jingle.ice_config, @@ -112,6 +115,10 @@ JingleSessionPC.prototype.doInitialize = function () { }; this.peerconnection.onsignalingstatechange = function (event) { if (!(self && self.peerconnection)) return; + console.info("Signaling: " + this.peerconnection.signalingState); + if (self.peerconnection.signalingState === 'stable') { + self.wasstable = true; + } self.updateModifySourcesQueue(); }; /** @@ -123,6 +130,7 @@ JingleSessionPC.prototype.doInitialize = function () { */ this.peerconnection.oniceconnectionstatechange = function (event) { if (!(self && self.peerconnection)) return; + console.info("Ice: " + self.peerconnection.iceConnectionState); self.updateModifySourcesQueue(); switch (self.peerconnection.iceConnectionState) { case 'connected': @@ -136,7 +144,7 @@ JingleSessionPC.prototype.doInitialize = function () { case 'disconnected': self.isreconnect = true; // Informs interested parties that the connection has been interrupted. - if (self.peerconnection.signalingState === 'stable') + if (self.wasstable) self.eventEmitter.emit(XMPPEvents.CONNECTION_INTERRUPTED); break; case 'failed':