diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-12 06:59:19 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-12 06:59:19 +0000 |
commit | 6cd326a5f0017fbe58353791afef089894c07841 (patch) | |
tree | 32ea3579b0c96ae9d473849d393bd78f5c471fd6 /remoting | |
parent | 0c256f62f05673820c4f37952dcd0505cebd3886 (diff) | |
download | chromium_src-6cd326a5f0017fbe58353791afef089894c07841.zip chromium_src-6cd326a5f0017fbe58353791afef089894c07841.tar.gz chromium_src-6cd326a5f0017fbe58353791afef089894c07841.tar.bz2 |
Keep quiet when there's no IQ data to process.
BUG=
TEST=Start a Remoting Viewer, let it idle for a while, and check the Debug Log for messages about Malformed XML packets. There should be no such messages.
Review URL: http://codereview.chromium.org/6973023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85103 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/client/appengine/static_files/chromoting_session.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/remoting/client/appengine/static_files/chromoting_session.js b/remoting/client/appengine/static_files/chromoting_session.js index 908e5e3..7c2a8b9 100644 --- a/remoting/client/appengine/static_files/chromoting_session.js +++ b/remoting/client/appengine/static_files/chromoting_session.js @@ -11,6 +11,7 @@ var MAX_DEBUG_LOG_SIZE = 1000; chromoting.messageId = 1; chromoting.scaleToFit = false; + // Default to trying to sandboxed connections. chromoting.connectMethod = 'sandboxed'; @@ -23,12 +24,16 @@ function feedIq() { xhr.withCredentials = true; xhr.onreadystatechange = function() { if (xhr.readyState == 4) { - if (xhr.status == 200 || xhr.status == 204) { + if (xhr.status == 200) { addToDebugLog('Receiving Iq: --' + xhr.responseText + '--'); chromoting.plugin.onIq(xhr.responseText); + } + if (xhr.status == 200 || xhr.status == 204) { window.setTimeout(feedIq, 0); } else { addToDebugLog("HttpXmpp gateway returned code: " + xhr.status); + chromoting.plugin.disconnect(); + setClientStateMessage("Failed"); } } } @@ -51,7 +56,6 @@ function registerConnection() { chromoting.plugin.connectSandboxed(clientjid, chromoting.hostjid, ''); // TODO(ajwong): This should just be feedIq(); window.setTimeout(feedIq, 1000); - window.setTimeout(updateStatusBarStats, 1000); } else { addToDebugLog('FailedToConnect: --' + xhr.responseText + '-- (status=' + xhr.status + ')'); @@ -129,7 +133,6 @@ function init() { // TODO:(jamiewalch): Pass in the correct nonce. plugin.connect(chromoting.username, chromoting.hostjid, chromoting.xmppAuthToken, ''); - window.setTimeout("updateStatusBarStats()", 1000); } } else { addToDebugLog('ERROR: chromoting plugin not loaded'); @@ -212,6 +215,7 @@ function connectionInfoUpdateCallback() { } else if (status == chromoting.plugin.STATUS_CONNECTED) { desktopSizeChanged(); setClientStateMessageFade('Connected to ' + chromoting.hostname, 1000); + window.setTimeout(updateStatusBarStats, 1000); } else if (status == chromoting.plugin.STATUS_CLOSED) { setClientStateMessage('Closed'); } else if (status == chromoting.plugin.STATUS_FAILED) { @@ -324,6 +328,8 @@ function addToDebugLog(message) { * @param {string} message The message to display. */ function updateStatusBarStats() { + if (chromoting.plugin.status != chromoting.plugin.STATUS_CONNECTED) + return; var videoBandwidth = chromoting.plugin.videoBandwidth; var videoCaptureLatency = chromoting.plugin.videoCaptureLatency; var videoEncodeLatency = chromoting.plugin.videoEncodeLatency; |