OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Functions related to the 'client screen' for Chromoting. | 7 * Functions related to the 'client screen' for Chromoting. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 if (oldState == remoting.ClientSession.State.CONNECTED) { | 248 if (oldState == remoting.ClientSession.State.CONNECTED) { |
249 remoting.clientSession.removePlugin(); | 249 remoting.clientSession.removePlugin(); |
250 remoting.clientSession = null; | 250 remoting.clientSession = null; |
251 console.log('Connection closed by host'); | 251 console.log('Connection closed by host'); |
252 if (remoting.currentConnectionType == remoting.ConnectionType.It2Me) { | 252 if (remoting.currentConnectionType == remoting.ConnectionType.It2Me) { |
253 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_IT2ME); | 253 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_IT2ME); |
254 } else { | 254 } else { |
255 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_ME2ME); | 255 remoting.setMode(remoting.AppMode.CLIENT_SESSION_FINISHED_ME2ME); |
256 } | 256 } |
257 } else { | 257 } else { |
258 // The transition from CONNECTING to CLOSED state may happen | 258 // A state transition from CONNECTING -> CLOSED can happen if the host |
259 // only with older client plugins. Current version should go the | 259 // closes the connection without an error message instead of accepting it. |
260 // FAILED state when connection fails. | 260 // For example, it does this if it fails to activate curtain mode. Since |
261 showConnectError_(remoting.Error.INVALID_ACCESS_CODE); | 261 // there's no way of knowing exactly what went wrong, we rely on server- |
262 // side logs in this case and show a generic error message. | |
263 showConnectError_(remoting.Error.UNEXPECTED); | |
Jamie
2012/11/28 23:52:32
I'm not particularly happy with this fix. I would
rmsousa
2012/11/29 00:11:14
This seems like a valid change regardless of the h
| |
262 } | 264 } |
263 | 265 |
264 } else if (newState == remoting.ClientSession.State.FAILED) { | 266 } else if (newState == remoting.ClientSession.State.FAILED) { |
265 console.error('Client plugin reported connection failed: ' + | 267 console.error('Client plugin reported connection failed: ' + |
266 remoting.clientSession.error); | 268 remoting.clientSession.error); |
267 clearPin = true; | 269 clearPin = true; |
268 if (remoting.clientSession.error == | 270 if (remoting.clientSession.error == |
269 remoting.ClientSession.ConnectionError.HOST_IS_OFFLINE) { | 271 remoting.ClientSession.ConnectionError.HOST_IS_OFFLINE) { |
270 clearPin = false; | 272 clearPin = false; |
271 retryConnectOrReportOffline_(); | 273 retryConnectOrReportOffline_(); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 remoting.ClientSession.Mode.ME2ME, onClientStateChange_); | 551 remoting.ClientSession.Mode.ME2ME, onClientStateChange_); |
550 // Don't log errors for cached JIDs. | 552 // Don't log errors for cached JIDs. |
551 remoting.clientSession.logErrors(!remoting.retryIfOffline); | 553 remoting.clientSession.logErrors(!remoting.retryIfOffline); |
552 remoting.clientSession.createPluginAndConnect( | 554 remoting.clientSession.createPluginAndConnect( |
553 document.getElementById('session-mode'), | 555 document.getElementById('session-mode'), |
554 token); | 556 token); |
555 } else { | 557 } else { |
556 showConnectError_(remoting.Error.AUTHENTICATION_FAILED); | 558 showConnectError_(remoting.Error.AUTHENTICATION_FAILED); |
557 } | 559 } |
558 } | 560 } |
OLD | NEW |