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 * Class handling creation and teardown of a remoting client session. | 7 * Class handling creation and teardown of a remoting client session. |
8 * | 8 * |
9 * The ClientSession class controls lifetime of the client plugin | 9 * The ClientSession class controls lifetime of the client plugin |
10 * object and provides the plugin with the functionality it needs to | 10 * object and provides the plugin with the functionality it needs to |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 * Disconnect the current session with a particular |error|. The session will | 262 * Disconnect the current session with a particular |error|. The session will |
263 * raise a |stateChanged| event in response to it. The caller should then call | 263 * raise a |stateChanged| event in response to it. The caller should then call |
264 * dispose() to remove and destroy the <embed> element. | 264 * dispose() to remove and destroy the <embed> element. |
265 * | 265 * |
266 * @param {!remoting.Error} error The reason for the disconnection. Use | 266 * @param {!remoting.Error} error The reason for the disconnection. Use |
267 * remoting.Error.none() if there is no error. | 267 * remoting.Error.none() if there is no error. |
268 * @return {void} Nothing. | 268 * @return {void} Nothing. |
269 */ | 269 */ |
270 remoting.ClientSession.prototype.disconnect = function(error) { | 270 remoting.ClientSession.prototype.disconnect = function(error) { |
271 if (this.isFinished()) { | 271 if (this.isFinished()) { |
| 272 // Do not send the session-terminate Iq if disconnect() is already called or |
| 273 // if it is initiated by the host. |
272 return; | 274 return; |
273 } | 275 } |
274 | 276 |
275 this.sendIq_( | 277 this.sendIq_( |
276 '<cli:iq ' + | 278 '<cli:iq ' + |
277 'to="' + this.host_.jabberId + '" ' + | 279 'to="' + this.host_.jabberId + '" ' + |
278 'type="set" ' + | 280 'type="set" ' + |
279 'id="session-terminate" ' + | 281 'id="session-terminate" ' + |
280 'xmlns:cli="jabber:client">' + | 282 'xmlns:cli="jabber:client">' + |
281 '<jingle ' + | 283 '<jingle ' + |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 * For example, if attempting a connection using a cached JID, host-offline | 598 * For example, if attempting a connection using a cached JID, host-offline |
597 * errors should not be logged because the JID will be refreshed and the | 599 * errors should not be logged because the JID will be refreshed and the |
598 * connection retried. | 600 * connection retried. |
599 * | 601 * |
600 * @param {boolean} enable True to log host-offline errors; false to suppress. | 602 * @param {boolean} enable True to log host-offline errors; false to suppress. |
601 */ | 603 */ |
602 remoting.ClientSession.prototype.logHostOfflineErrors = function(enable) { | 604 remoting.ClientSession.prototype.logHostOfflineErrors = function(enable) { |
603 this.logHostOfflineErrors_ = enable; | 605 this.logHostOfflineErrors_ = enable; |
604 }; | 606 }; |
605 | 607 |
OLD | NEW |