OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
9 | 9 |
10 /** | 10 /** |
(...skipping 21 matching lines...) Expand all Loading... | |
32 /** @private {?function(remoting.SignalStrategy.State)} */ | 32 /** @private {?function(remoting.SignalStrategy.State)} */ |
33 this.onStateChangedCallback_ = null; | 33 this.onStateChangedCallback_ = null; |
34 | 34 |
35 /** @private {?function(Element):void} */ | 35 /** @private {?function(Element):void} */ |
36 this.onIncomingStanzaCallback_ = null; | 36 this.onIncomingStanzaCallback_ = null; |
37 | 37 |
38 /** | 38 /** |
39 * @private {number} | 39 * @private {number} |
40 * @const | 40 * @const |
41 */ | 41 */ |
42 this.PRIMARY_CONNECT_TIMEOUT_MS_ = 10 * 1000; | 42 this.PRIMARY_CONNECT_TIMEOUT_MS_ = 25 * 1000; |
Jamie
2017/04/26 17:25:40
Looking at the stats, there's a big spike in XMPP/
| |
43 | 43 |
44 /** | 44 /** |
45 * @enum {string} | 45 * @enum {string} |
46 * @private | 46 * @private |
47 */ | 47 */ |
48 this.State = { | 48 this.State = { |
49 NOT_CONNECTED: 'not-connected', | 49 NOT_CONNECTED: 'not-connected', |
50 PRIMARY_PENDING: 'primary-pending', | 50 PRIMARY_PENDING: 'primary-pending', |
51 PRIMARY_SUCCEEDED: 'primary-succeeded', | 51 PRIMARY_SUCCEEDED: 'primary-succeeded', |
52 SECONDARY_PENDING: 'secondary-pending', | 52 SECONDARY_PENDING: 'secondary-pending', |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 if (this.state_ == this.State.PRIMARY_PENDING) { | 224 if (this.state_ == this.State.PRIMARY_PENDING) { |
225 window.clearTimeout(this.primaryConnectTimerId_); | 225 window.clearTimeout(this.primaryConnectTimerId_); |
226 this.updateProgress_( | 226 this.updateProgress_( |
227 this.primary_, | 227 this.primary_, |
228 remoting.FallbackSignalStrategy.Progress.SUCCEEDED); | 228 remoting.FallbackSignalStrategy.Progress.SUCCEEDED); |
229 this.state_ = this.State.PRIMARY_SUCCEEDED; | 229 this.state_ = this.State.PRIMARY_SUCCEEDED; |
230 } else { | 230 } else { |
231 this.updateProgress_( | 231 this.updateProgress_( |
232 this.primary_, | 232 this.primary_, |
233 remoting.FallbackSignalStrategy.Progress.SUCCEEDED_LATE); | 233 remoting.FallbackSignalStrategy.Progress.SUCCEEDED_LATE); |
234 return; // Don't notify the external callback | |
234 } | 235 } |
235 break; | 236 break; |
236 | 237 |
237 case remoting.SignalStrategy.State.FAILED: | 238 case remoting.SignalStrategy.State.FAILED: |
238 if (this.state_ == this.State.PRIMARY_PENDING) { | 239 if (this.state_ == this.State.PRIMARY_PENDING) { |
239 window.clearTimeout(this.primaryConnectTimerId_); | 240 window.clearTimeout(this.primaryConnectTimerId_); |
240 this.updateProgress_( | 241 this.updateProgress_( |
241 this.primary_, | 242 this.primary_, |
242 remoting.FallbackSignalStrategy.Progress.FAILED); | 243 remoting.FallbackSignalStrategy.Progress.FAILED); |
243 this.connectSecondary_(); | 244 this.connectSecondary_(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 * @param {remoting.SignalStrategy} strategy | 334 * @param {remoting.SignalStrategy} strategy |
334 * @param {remoting.FallbackSignalStrategy.Progress} progress | 335 * @param {remoting.FallbackSignalStrategy.Progress} progress |
335 * @private | 336 * @private |
336 */ | 337 */ |
337 remoting.FallbackSignalStrategy.prototype.updateProgress_ = function( | 338 remoting.FallbackSignalStrategy.prototype.updateProgress_ = function( |
338 strategy, progress) { | 339 strategy, progress) { |
339 console.log('FallbackSignalStrategy progress: ' + strategy.getType() + ' ' + | 340 console.log('FallbackSignalStrategy progress: ' + strategy.getType() + ' ' + |
340 progress); | 341 progress); |
341 this.logger_.logSignalStrategyProgress(strategy.getType(), progress); | 342 this.logger_.logSignalStrategyProgress(strategy.getType(), progress); |
342 }; | 343 }; |
OLD | NEW |