Commit 8204ede6 authored by sergeyu@chromium.org's avatar sergeyu@chromium.org

Make reconnection in response to video channel inactivity less aggressive.

Previously immediate reconnection was triggered by the video channel
becoming inactive. That can cause spurious reconnects on flaky networks.
Now the webapp will always wait for 10 seconds before trying to reconnect.

BUG=375568

Review URL: https://codereview.chromium.org/297963005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272695 0039d316-1c4b-4281-b951-d872f2087c98
parent 4fb02eab
...@@ -62,8 +62,7 @@ remoting.SmartReconnector = function(connector, clientSession) { ...@@ -62,8 +62,7 @@ remoting.SmartReconnector = function(connector, clientSession) {
// to connect. // to connect.
remoting.SmartReconnector.kReconnectDelay = 2000; remoting.SmartReconnector.kReconnectDelay = 2000;
// If no frames are received from the server for more than |kConnectionTimeout|, // If the video channel is inactive for 10 seconds reconnect the session.
// disconnect the session.
remoting.SmartReconnector.kConnectionTimeout = 10000; remoting.SmartReconnector.kConnectionTimeout = 10000;
remoting.SmartReconnector.prototype = { remoting.SmartReconnector.prototype = {
...@@ -97,22 +96,13 @@ remoting.SmartReconnector.prototype = { ...@@ -97,22 +96,13 @@ remoting.SmartReconnector.prototype = {
}, },
/** /**
* @param {boolean} active This function is called if no frames are received * @param {boolean} active True if the video channel is active.
* on the client for more than 1 second.
*/ */
videoChannelStateChanged_: function (active) { videoChannelStateChanged_: function (active) {
this.cancelPending_(); this.cancelPending_();
if (!active) { if (!active) {
// If the channel becomes inactive due to a lack of network connection, window.addEventListener(
// wait for it to go online. The plugin will try to reconnect the video
// channel once it is online. If the video channels doesn't finish
// reconnecting within the timeout, tear down the session and reconnect.
if (navigator.onLine) {
this.reconnect_();
} else {
window.addEventListener(
'online', this.bound_.startReconnectTimeout, false); 'online', this.bound_.startReconnectTimeout, false);
}
} }
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment