@webex/plugin-meetings 3.3.1 → 3.4.0-next.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +7 -2
  3. package/dist/breakouts/index.js.map +1 -1
  4. package/dist/constants.js +11 -4
  5. package/dist/constants.js.map +1 -1
  6. package/dist/interpretation/index.js +1 -1
  7. package/dist/interpretation/siLanguage.js +1 -1
  8. package/dist/locus-info/selfUtils.js +0 -5
  9. package/dist/locus-info/selfUtils.js.map +1 -1
  10. package/dist/media/MediaConnectionAwaiter.js +70 -15
  11. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  12. package/dist/media/index.js +18 -9
  13. package/dist/media/index.js.map +1 -1
  14. package/dist/meeting/connectionStateHandler.js +67 -0
  15. package/dist/meeting/connectionStateHandler.js.map +1 -0
  16. package/dist/meeting/index.js +576 -374
  17. package/dist/meeting/index.js.map +1 -1
  18. package/dist/meeting/locusMediaRequest.js +7 -0
  19. package/dist/meeting/locusMediaRequest.js.map +1 -1
  20. package/dist/meeting/muteState.js +6 -1
  21. package/dist/meeting/muteState.js.map +1 -1
  22. package/dist/meeting/util.js +1 -0
  23. package/dist/meeting/util.js.map +1 -1
  24. package/dist/meeting-info/index.js +4 -4
  25. package/dist/meeting-info/index.js.map +1 -1
  26. package/dist/meeting-info/meeting-info-v2.js +2 -2
  27. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  28. package/dist/meeting-info/util.js +17 -17
  29. package/dist/meeting-info/util.js.map +1 -1
  30. package/dist/meeting-info/utilv2.js +16 -16
  31. package/dist/meeting-info/utilv2.js.map +1 -1
  32. package/dist/meetings/collection.js +1 -1
  33. package/dist/meetings/collection.js.map +1 -1
  34. package/dist/meetings/index.js +41 -35
  35. package/dist/meetings/index.js.map +1 -1
  36. package/dist/meetings/meetings.types.js +8 -0
  37. package/dist/meetings/meetings.types.js.map +1 -1
  38. package/dist/meetings/util.js +3 -2
  39. package/dist/meetings/util.js.map +1 -1
  40. package/dist/metrics/constants.js +2 -1
  41. package/dist/metrics/constants.js.map +1 -1
  42. package/dist/metrics/index.js +57 -0
  43. package/dist/metrics/index.js.map +1 -1
  44. package/dist/personal-meeting-room/index.js +1 -1
  45. package/dist/personal-meeting-room/index.js.map +1 -1
  46. package/dist/reachability/clusterReachability.js +108 -53
  47. package/dist/reachability/clusterReachability.js.map +1 -1
  48. package/dist/reachability/index.js +546 -115
  49. package/dist/reachability/index.js.map +1 -1
  50. package/dist/reconnection-manager/index.js +1 -1
  51. package/dist/reconnection-manager/index.js.map +1 -1
  52. package/dist/rtcMetrics/index.js +26 -6
  53. package/dist/rtcMetrics/index.js.map +1 -1
  54. package/dist/types/constants.d.ts +11 -3
  55. package/dist/types/media/MediaConnectionAwaiter.d.ts +24 -4
  56. package/dist/types/meeting/connectionStateHandler.d.ts +30 -0
  57. package/dist/types/meeting/index.d.ts +28 -8
  58. package/dist/types/meeting/locusMediaRequest.d.ts +2 -0
  59. package/dist/types/meeting-info/index.d.ts +3 -2
  60. package/dist/types/meeting-info/meeting-info-v2.d.ts +3 -2
  61. package/dist/types/meeting-info/util.d.ts +5 -4
  62. package/dist/types/meeting-info/utilv2.d.ts +3 -2
  63. package/dist/types/meetings/collection.d.ts +3 -2
  64. package/dist/types/meetings/index.d.ts +6 -4
  65. package/dist/types/meetings/meetings.types.d.ts +9 -0
  66. package/dist/types/metrics/constants.d.ts +1 -0
  67. package/dist/types/metrics/index.d.ts +15 -0
  68. package/dist/types/reachability/clusterReachability.d.ts +31 -3
  69. package/dist/types/reachability/index.d.ts +107 -4
  70. package/dist/types/rtcMetrics/index.d.ts +11 -1
  71. package/dist/webinar/index.js +1 -1
  72. package/package.json +23 -23
  73. package/src/breakouts/index.ts +7 -1
  74. package/src/constants.ts +13 -17
  75. package/src/locus-info/selfUtils.ts +0 -5
  76. package/src/media/MediaConnectionAwaiter.ts +89 -14
  77. package/src/media/index.ts +18 -9
  78. package/src/meeting/connectionStateHandler.ts +65 -0
  79. package/src/meeting/index.ts +541 -298
  80. package/src/meeting/locusMediaRequest.ts +5 -0
  81. package/src/meeting/muteState.ts +6 -1
  82. package/src/meeting/util.ts +1 -0
  83. package/src/meeting-info/index.ts +9 -6
  84. package/src/meeting-info/meeting-info-v2.ts +4 -4
  85. package/src/meeting-info/util.ts +23 -28
  86. package/src/meeting-info/utilv2.ts +18 -24
  87. package/src/meetings/collection.ts +3 -3
  88. package/src/meetings/index.ts +43 -43
  89. package/src/meetings/meetings.types.ts +11 -0
  90. package/src/meetings/util.ts +5 -4
  91. package/src/metrics/constants.ts +1 -0
  92. package/src/metrics/index.ts +44 -0
  93. package/src/personal-meeting-room/index.ts +2 -2
  94. package/src/reachability/clusterReachability.ts +86 -25
  95. package/src/reachability/index.ts +364 -30
  96. package/src/reconnection-manager/index.ts +1 -1
  97. package/src/rtcMetrics/index.ts +25 -5
  98. package/test/unit/spec/breakouts/index.ts +51 -32
  99. package/test/unit/spec/locus-info/selfUtils.js +25 -23
  100. package/test/unit/spec/media/MediaConnectionAwaiter.ts +131 -32
  101. package/test/unit/spec/media/index.ts +75 -34
  102. package/test/unit/spec/meeting/connectionStateHandler.ts +102 -0
  103. package/test/unit/spec/meeting/index.js +807 -185
  104. package/test/unit/spec/meeting/locusMediaRequest.ts +7 -0
  105. package/test/unit/spec/meeting/muteState.js +24 -0
  106. package/test/unit/spec/meeting-info/index.js +4 -4
  107. package/test/unit/spec/meeting-info/meetinginfov2.js +24 -28
  108. package/test/unit/spec/meeting-info/request.js +2 -2
  109. package/test/unit/spec/meeting-info/utilv2.js +41 -49
  110. package/test/unit/spec/meetings/index.js +44 -3
  111. package/test/unit/spec/metrics/index.js +126 -0
  112. package/test/unit/spec/multistream/mediaRequestManager.ts +2 -2
  113. package/test/unit/spec/personal-meeting-room/personal-meeting-room.js +2 -2
  114. package/test/unit/spec/reachability/clusterReachability.ts +116 -22
  115. package/test/unit/spec/reachability/index.ts +1398 -131
  116. package/test/unit/spec/rtcMetrics/index.ts +32 -0
  117. package/dist/mediaQualityMetrics/config.js +0 -321
  118. package/dist/mediaQualityMetrics/config.js.map +0 -1
  119. package/dist/networkQualityMonitor/index.js +0 -227
  120. package/dist/networkQualityMonitor/index.js.map +0 -1
  121. package/dist/statsAnalyzer/global.js +0 -44
  122. package/dist/statsAnalyzer/global.js.map +0 -1
  123. package/dist/statsAnalyzer/index.js +0 -1072
  124. package/dist/statsAnalyzer/index.js.map +0 -1
  125. package/dist/statsAnalyzer/mqaUtil.js +0 -368
  126. package/dist/statsAnalyzer/mqaUtil.js.map +0 -1
  127. package/dist/types/mediaQualityMetrics/config.d.ts +0 -247
  128. package/dist/types/networkQualityMonitor/index.d.ts +0 -70
  129. package/dist/types/statsAnalyzer/global.d.ts +0 -36
  130. package/dist/types/statsAnalyzer/index.d.ts +0 -217
  131. package/dist/types/statsAnalyzer/mqaUtil.d.ts +0 -48
  132. package/src/mediaQualityMetrics/config.ts +0 -255
  133. package/src/networkQualityMonitor/index.ts +0 -211
  134. package/src/statsAnalyzer/global.ts +0 -37
  135. package/src/statsAnalyzer/index.ts +0 -1318
  136. package/src/statsAnalyzer/mqaUtil.ts +0 -463
  137. package/test/unit/spec/networkQualityMonitor/index.js +0 -99
  138. package/test/unit/spec/stats-analyzer/index.js +0 -1819
@@ -1,55 +1,108 @@
1
1
  "use strict";
2
2
 
3
+ var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
4
+ var _Object$keys2 = require("@babel/runtime-corejs2/core-js/object/keys");
5
+ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
6
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
7
+ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
8
+ var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
3
9
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
10
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
5
11
  _Object$defineProperty(exports, "__esModule", {
6
12
  value: true
7
13
  });
8
14
  exports.default = void 0;
9
- var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
10
15
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
11
16
  var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
12
17
  var _entries = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/entries"));
13
18
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
14
- var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
19
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
20
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
15
21
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
16
22
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
17
23
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
18
24
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
25
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
26
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
27
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
28
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
19
29
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
20
30
  var _lodash = require("lodash");
31
+ var _common = require("@webex/common");
21
32
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
22
33
  var _util = _interopRequireDefault(require("../meeting/util"));
23
34
  var _constants = require("../constants");
24
35
  var _request = _interopRequireDefault(require("./request"));
25
36
  var _clusterReachability = require("./clusterReachability");
26
- /*!
37
+ var _eventsScope = _interopRequireDefault(require("../common/events/events-scope"));
38
+ var _constants2 = _interopRequireDefault(require("../metrics/constants"));
39
+ var _metrics = _interopRequireDefault(require("../metrics"));
40
+ function ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
41
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
42
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
43
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /*!
27
44
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
28
- */
29
- /* eslint-disable class-methods-use-this */
45
+ */ /* eslint-disable class-methods-use-this */
30
46
  /**
31
47
  * This is the type that matches what backend expects us to send to them. It is a bit weird, because
32
48
  * it uses strings instead of booleans and numbers, but that's what they require.
33
49
  */
50
+
34
51
  // this is the type that is required by the backend when we send them reachability results
52
+
35
53
  // this is the type used by Reachability class internally and stored in local storage
54
+
55
+ // timeouts in seconds
56
+ var DEFAULT_TIMEOUT = 3;
57
+ var VIDEO_MESH_TIMEOUT = 1;
58
+ var OVERALL_TIMEOUT = 15;
59
+
36
60
  /**
37
61
  * @class Reachability
38
62
  * @export
39
63
  */
40
- var Reachability = exports.default = /*#__PURE__*/function () {
64
+ var Reachability = exports.default = /*#__PURE__*/function (_EventsScope) {
65
+ (0, _inherits2.default)(Reachability, _EventsScope);
66
+ var _super = _createSuper(Reachability);
41
67
  /**
42
68
  * Creates an instance of Reachability.
43
69
  * @param {object} webex
44
70
  * @memberof Reachability
45
71
  */
46
72
  function Reachability(webex) {
73
+ var _this;
47
74
  (0, _classCallCheck2.default)(this, Reachability);
48
- (0, _defineProperty2.default)(this, "namespace", _constants.REACHABILITY.namespace);
49
- (0, _defineProperty2.default)(this, "webex", void 0);
50
- (0, _defineProperty2.default)(this, "reachabilityRequest", void 0);
51
- (0, _defineProperty2.default)(this, "clusterReachability", void 0);
52
- this.webex = webex;
75
+ _this = _super.call(this);
76
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "namespace", _constants.REACHABILITY.namespace);
77
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "webex", void 0);
78
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "reachabilityRequest", void 0);
79
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clusterReachability", void 0);
80
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "reachabilityDefer", void 0);
81
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "vmnTimer", void 0);
82
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "publicCloudTimer", void 0);
83
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "overallTimer", void 0);
84
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "expectedResultsCount", {
85
+ videoMesh: {
86
+ udp: 0
87
+ },
88
+ public: {
89
+ udp: 0,
90
+ tcp: 0,
91
+ xtls: 0
92
+ }
93
+ });
94
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resultsCount", {
95
+ videoMesh: {
96
+ udp: 0
97
+ },
98
+ public: {
99
+ udp: 0,
100
+ tcp: 0,
101
+ xtls: 0
102
+ }
103
+ });
104
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "lastTrigger", void 0);
105
+ _this.webex = webex;
53
106
 
54
107
  /**
55
108
  * internal request object for the server
@@ -58,55 +111,114 @@ var Reachability = exports.default = /*#__PURE__*/function () {
58
111
  * @private
59
112
  * @memberof Reachability
60
113
  */
61
- this.reachabilityRequest = new _request.default(this.webex);
62
- this.clusterReachability = {};
114
+ _this.reachabilityRequest = new _request.default(_this.webex);
115
+ _this.clusterReachability = {};
116
+ return _this;
63
117
  }
64
118
 
65
119
  /**
66
- * Gets a list of media clusters from the backend and performs reachability checks on all the clusters
67
- * @returns {Promise<ReachabilityResults>} reachability results
68
- * @public
69
- * @memberof Reachability
120
+ * Fetches the list of media clusters from the backend
121
+ * @param {boolean} isRetry
122
+ * @private
123
+ * @returns {Promise<{clusters: ClusterList, joinCookie: any}>}
70
124
  */
71
125
  (0, _createClass2.default)(Reachability, [{
72
- key: "gatherReachability",
126
+ key: "getClusters",
73
127
  value: (function () {
74
- var _gatherReachability = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
75
- var _yield$this$reachabil, clusters, joinCookie, results;
128
+ var _getClusters = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
129
+ var isRetry,
130
+ _yield$this$reachabil,
131
+ clusters,
132
+ joinCookie,
133
+ _args = arguments;
76
134
  return _regenerator.default.wrap(function _callee$(_context) {
77
135
  while (1) switch (_context.prev = _context.next) {
78
136
  case 0:
79
- _context.prev = 0;
80
- _context.next = 3;
137
+ isRetry = _args.length > 0 && _args[0] !== undefined ? _args[0] : false;
138
+ _context.prev = 1;
139
+ _context.next = 4;
81
140
  return this.reachabilityRequest.getClusters(_util.default.getIpVersion(this.webex));
82
- case 3:
141
+ case 4:
83
142
  _yield$this$reachabil = _context.sent;
84
143
  clusters = _yield$this$reachabil.clusters;
85
144
  joinCookie = _yield$this$reachabil.joinCookie;
86
- _context.next = 8;
87
- return this.performReachabilityChecks(clusters);
88
- case 8:
89
- results = _context.sent;
90
- _context.next = 11;
91
- return this.webex.boundedStorage.put(this.namespace, _constants.REACHABILITY.localStorageResult, (0, _stringify.default)(results));
92
- case 11:
93
- _context.next = 13;
145
+ return _context.abrupt("return", {
146
+ clusters: clusters,
147
+ joinCookie: joinCookie
148
+ });
149
+ case 10:
150
+ _context.prev = 10;
151
+ _context.t0 = _context["catch"](1);
152
+ if (!isRetry) {
153
+ _context.next = 14;
154
+ break;
155
+ }
156
+ throw _context.t0;
157
+ case 14:
158
+ _loggerProxy.default.logger.error("Reachability:index#getClusters --> Failed with error: ".concat(_context.t0, ", retrying..."));
159
+ return _context.abrupt("return", this.getClusters(true));
160
+ case 16:
161
+ case "end":
162
+ return _context.stop();
163
+ }
164
+ }, _callee, this, [[1, 10]]);
165
+ }));
166
+ function getClusters() {
167
+ return _getClusters.apply(this, arguments);
168
+ }
169
+ return getClusters;
170
+ }()
171
+ /**
172
+ * Gets a list of media clusters from the backend and performs reachability checks on all the clusters
173
+ * @param {string} trigger - explains the reason for starting reachability
174
+ * @returns {Promise<ReachabilityResults>} reachability results
175
+ * @public
176
+ * @memberof Reachability
177
+ */
178
+ )
179
+ }, {
180
+ key: "gatherReachability",
181
+ value: (function () {
182
+ var _gatherReachability = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(trigger) {
183
+ var _yield$this$getCluste, clusters, joinCookie;
184
+ return _regenerator.default.wrap(function _callee2$(_context2) {
185
+ while (1) switch (_context2.prev = _context2.next) {
186
+ case 0:
187
+ _context2.prev = 0;
188
+ this.lastTrigger = trigger;
189
+
190
+ // kick off ip version detection. For now we don't await it, as we're doing it
191
+ // to gather the timings and send them with our reachability metrics
192
+ // @ts-ignore
193
+ this.webex.internal.device.ipNetworkDetector.detect();
194
+ _context2.next = 5;
195
+ return this.getClusters();
196
+ case 5:
197
+ _yield$this$getCluste = _context2.sent;
198
+ clusters = _yield$this$getCluste.clusters;
199
+ joinCookie = _yield$this$getCluste.joinCookie;
200
+ _context2.next = 10;
94
201
  return this.webex.boundedStorage.put(this.namespace, _constants.REACHABILITY.localStorageJoinCookie, (0, _stringify.default)(joinCookie));
202
+ case 10:
203
+ this.reachabilityDefer = new _common.Defer();
204
+
205
+ // Perform Reachability Check
206
+ _context2.next = 13;
207
+ return this.performReachabilityChecks(clusters);
95
208
  case 13:
96
- _loggerProxy.default.logger.log('Reachability:index#gatherReachability --> Reachability checks completed');
97
- return _context.abrupt("return", results);
98
- case 17:
99
- _context.prev = 17;
100
- _context.t0 = _context["catch"](0);
101
- _loggerProxy.default.logger.error("Reachability:index#gatherReachability --> Error:", _context.t0);
102
- return _context.abrupt("return", {});
103
- case 21:
209
+ return _context2.abrupt("return", this.reachabilityDefer.promise);
210
+ case 16:
211
+ _context2.prev = 16;
212
+ _context2.t0 = _context2["catch"](0);
213
+ _loggerProxy.default.logger.error("Reachability:index#gatherReachability --> Error:", _context2.t0);
214
+ return _context2.abrupt("return", {});
215
+ case 20:
104
216
  case "end":
105
- return _context.stop();
217
+ return _context2.stop();
106
218
  }
107
- }, _callee, this, [[0, 17]]);
219
+ }, _callee2, this, [[0, 16]]);
108
220
  }));
109
- function gatherReachability() {
221
+ function gatherReachability(_x) {
110
222
  return _gatherReachability.apply(this, arguments);
111
223
  }
112
224
  return gatherReachability;
@@ -121,10 +233,10 @@ var Reachability = exports.default = /*#__PURE__*/function () {
121
233
  }, {
122
234
  key: "getReachabilityMetrics",
123
235
  value: (function () {
124
- var _getReachabilityMetrics = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
236
+ var _getReachabilityMetrics = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
125
237
  var stats, updateStats, resultsJson, results;
126
- return _regenerator.default.wrap(function _callee2$(_context2) {
127
- while (1) switch (_context2.prev = _context2.next) {
238
+ return _regenerator.default.wrap(function _callee3$(_context3) {
239
+ while (1) switch (_context3.prev = _context3.next) {
128
240
  case 0:
129
241
  stats = {
130
242
  reachability_public_udp_success: 0,
@@ -154,29 +266,29 @@ var Reachability = exports.default = /*#__PURE__*/function () {
154
266
  stats["reachability_".concat(clusterType, "_xtls_").concat(_outcome2)] += 1;
155
267
  }
156
268
  };
157
- _context2.prev = 2;
158
- _context2.next = 5;
269
+ _context3.prev = 2;
270
+ _context3.next = 5;
159
271
  return this.webex.boundedStorage.get(_constants.REACHABILITY.namespace, _constants.REACHABILITY.localStorageResult);
160
272
  case 5:
161
- resultsJson = _context2.sent;
273
+ resultsJson = _context3.sent;
162
274
  results = JSON.parse(resultsJson);
163
275
  (0, _values.default)(results).forEach(function (result) {
164
276
  updateStats(result.isVideoMesh ? 'vmn' : 'public', result);
165
277
  });
166
- _context2.next = 13;
278
+ _context3.next = 13;
167
279
  break;
168
280
  case 10:
169
- _context2.prev = 10;
170
- _context2.t0 = _context2["catch"](2);
281
+ _context3.prev = 10;
282
+ _context3.t0 = _context3["catch"](2);
171
283
  // empty storage, that's ok
172
- _loggerProxy.default.logger.warn('Roap:request#getReachabilityMetrics --> Error parsing reachability data: ', _context2.t0);
284
+ _loggerProxy.default.logger.warn('Roap:request#getReachabilityMetrics --> Error parsing reachability data: ', _context3.t0);
173
285
  case 13:
174
- return _context2.abrupt("return", stats);
286
+ return _context3.abrupt("return", stats);
175
287
  case 14:
176
288
  case "end":
177
- return _context2.stop();
289
+ return _context3.stop();
178
290
  }
179
- }, _callee2, this, [[2, 10]]);
291
+ }, _callee3, this, [[2, 10]]);
180
292
  }));
181
293
  function getReachabilityMetrics() {
182
294
  return _getReachabilityMetrics.apply(this, arguments);
@@ -229,45 +341,45 @@ var Reachability = exports.default = /*#__PURE__*/function () {
229
341
  }, {
230
342
  key: "getReachabilityResults",
231
343
  value: (function () {
232
- var _getReachabilityResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
233
- var _this = this;
344
+ var _getReachabilityResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
345
+ var _this2 = this;
234
346
  var results, resultsJson, allClusterResults;
235
- return _regenerator.default.wrap(function _callee3$(_context3) {
236
- while (1) switch (_context3.prev = _context3.next) {
347
+ return _regenerator.default.wrap(function _callee4$(_context4) {
348
+ while (1) switch (_context4.prev = _context4.next) {
237
349
  case 0:
238
- _context3.prev = 0;
239
- _context3.next = 3;
350
+ _context4.prev = 0;
351
+ _context4.next = 3;
240
352
  return this.webex.boundedStorage.get(_constants.REACHABILITY.namespace, _constants.REACHABILITY.localStorageResult);
241
353
  case 3:
242
- resultsJson = _context3.sent;
354
+ resultsJson = _context4.sent;
243
355
  allClusterResults = JSON.parse(resultsJson);
244
356
  results = (0, _lodash.mapValues)(allClusterResults, function (clusterResult) {
245
357
  return {
246
- udp: _this.mapTransportResultToBackendDataFormat(clusterResult.udp || {
358
+ udp: _this2.mapTransportResultToBackendDataFormat(clusterResult.udp || {
247
359
  result: 'untested'
248
360
  }),
249
- tcp: _this.mapTransportResultToBackendDataFormat(clusterResult.tcp || {
361
+ tcp: _this2.mapTransportResultToBackendDataFormat(clusterResult.tcp || {
250
362
  result: 'untested'
251
363
  }),
252
- xtls: _this.mapTransportResultToBackendDataFormat(clusterResult.xtls || {
364
+ xtls: _this2.mapTransportResultToBackendDataFormat(clusterResult.xtls || {
253
365
  result: 'untested'
254
366
  })
255
367
  };
256
368
  });
257
- _context3.next = 11;
369
+ _context4.next = 11;
258
370
  break;
259
371
  case 8:
260
- _context3.prev = 8;
261
- _context3.t0 = _context3["catch"](0);
372
+ _context4.prev = 8;
373
+ _context4.t0 = _context4["catch"](0);
262
374
  // empty storage, that's ok
263
- _loggerProxy.default.logger.warn('Roap:request#attachReachabilityData --> Error parsing reachability data: ', _context3.t0);
375
+ _loggerProxy.default.logger.warn('Roap:request#attachReachabilityData --> Error parsing reachability data: ', _context4.t0);
264
376
  case 11:
265
- return _context3.abrupt("return", results);
377
+ return _context4.abrupt("return", results);
266
378
  case 12:
267
379
  case "end":
268
- return _context3.stop();
380
+ return _context4.stop();
269
381
  }
270
- }, _callee3, this, [[0, 8]]);
382
+ }, _callee4, this, [[0, 8]]);
271
383
  }));
272
384
  function getReachabilityResults() {
273
385
  return _getReachabilityResults.apply(this, arguments);
@@ -284,16 +396,16 @@ var Reachability = exports.default = /*#__PURE__*/function () {
284
396
  }, {
285
397
  key: "isAnyPublicClusterReachable",
286
398
  value: (function () {
287
- var _isAnyPublicClusterReachable = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
399
+ var _isAnyPublicClusterReachable = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
288
400
  var reachable, reachabilityData, reachabilityResults;
289
- return _regenerator.default.wrap(function _callee4$(_context4) {
290
- while (1) switch (_context4.prev = _context4.next) {
401
+ return _regenerator.default.wrap(function _callee5$(_context5) {
402
+ while (1) switch (_context5.prev = _context5.next) {
291
403
  case 0:
292
404
  reachable = false; // @ts-ignore
293
- _context4.next = 3;
405
+ _context5.next = 3;
294
406
  return this.webex.boundedStorage.get(this.namespace, _constants.REACHABILITY.localStorageResult).catch(function () {});
295
407
  case 3:
296
- reachabilityData = _context4.sent;
408
+ reachabilityData = _context5.sent;
297
409
  if (reachabilityData) {
298
410
  try {
299
411
  reachabilityResults = JSON.parse(reachabilityData);
@@ -305,12 +417,12 @@ var Reachability = exports.default = /*#__PURE__*/function () {
305
417
  _loggerProxy.default.logger.error("Roap:request#attachReachabilityData --> Error in parsing reachability data: ".concat(e));
306
418
  }
307
419
  }
308
- return _context4.abrupt("return", reachable);
420
+ return _context5.abrupt("return", reachable);
309
421
  case 6:
310
422
  case "end":
311
- return _context4.stop();
423
+ return _context5.stop();
312
424
  }
313
- }, _callee4, this);
425
+ }, _callee5, this);
314
426
  }));
315
427
  function isAnyPublicClusterReachable() {
316
428
  return _isAnyPublicClusterReachable.apply(this, arguments);
@@ -331,16 +443,16 @@ var Reachability = exports.default = /*#__PURE__*/function () {
331
443
  }, {
332
444
  key: "isWebexMediaBackendUnreachable",
333
445
  value: (function () {
334
- var _isWebexMediaBackendUnreachable = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
446
+ var _isWebexMediaBackendUnreachable = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
335
447
  var unreachable, reachabilityData, reachabilityResults, protocols;
336
- return _regenerator.default.wrap(function _callee5$(_context5) {
337
- while (1) switch (_context5.prev = _context5.next) {
448
+ return _regenerator.default.wrap(function _callee6$(_context6) {
449
+ while (1) switch (_context6.prev = _context6.next) {
338
450
  case 0:
339
451
  unreachable = false; // @ts-ignore
340
- _context5.next = 3;
452
+ _context6.next = 3;
341
453
  return this.webex.boundedStorage.get(this.namespace, _constants.REACHABILITY.localStorageResult).catch(function () {});
342
454
  case 3:
343
- reachabilityData = _context5.sent;
455
+ reachabilityData = _context6.sent;
344
456
  if (reachabilityData) {
345
457
  try {
346
458
  reachabilityResults = JSON.parse(reachabilityData);
@@ -378,12 +490,12 @@ var Reachability = exports.default = /*#__PURE__*/function () {
378
490
  _loggerProxy.default.logger.error("Roap:request#attachReachabilityData --> Error in parsing reachability data: ".concat(e));
379
491
  }
380
492
  }
381
- return _context5.abrupt("return", unreachable);
493
+ return _context6.abrupt("return", unreachable);
382
494
  case 6:
383
495
  case "end":
384
- return _context5.stop();
496
+ return _context6.stop();
385
497
  }
386
- }, _callee5, this);
498
+ }, _callee6, this);
387
499
  }));
388
500
  function isWebexMediaBackendUnreachable() {
389
501
  return _isWebexMediaBackendUnreachable.apply(this, arguments);
@@ -445,71 +557,390 @@ var Reachability = exports.default = /*#__PURE__*/function () {
445
557
  });
446
558
  }
447
559
 
560
+ /**
561
+ * Returns true if we've obtained all the reachability results for all the public clusters
562
+ * In other words, it means that all public clusters are reachable over each protocol,
563
+ * because we only get a "result" if we managed to reach a cluster
564
+ *
565
+ * @returns {boolean}
566
+ */
567
+ }, {
568
+ key: "areAllPublicClusterResultsReady",
569
+ value: function areAllPublicClusterResultsReady() {
570
+ return (0, _lodash.isEqual)(this.expectedResultsCount.public, this.resultsCount.public);
571
+ }
572
+
573
+ /**
574
+ * Returns true if we've obtained all the reachability results for all the clusters
575
+ *
576
+ * @returns {boolean}
577
+ */
578
+ }, {
579
+ key: "areAllResultsReady",
580
+ value: function areAllResultsReady() {
581
+ return (0, _lodash.isEqual)(this.expectedResultsCount, this.resultsCount);
582
+ }
583
+
584
+ /**
585
+ * Resolves the promise returned by gatherReachability() method
586
+ * @returns {void}
587
+ */
588
+ }, {
589
+ key: "resolveReachabilityPromise",
590
+ value: function resolveReachabilityPromise() {
591
+ var _this$reachabilityDef;
592
+ if (this.vmnTimer) {
593
+ clearTimeout(this.vmnTimer);
594
+ }
595
+ if (this.publicCloudTimer) {
596
+ clearTimeout(this.publicCloudTimer);
597
+ }
598
+ this.logUnreachableClusters();
599
+ (_this$reachabilityDef = this.reachabilityDefer) === null || _this$reachabilityDef === void 0 ? void 0 : _this$reachabilityDef.resolve();
600
+ }
601
+
602
+ /**
603
+ * Aborts all cluster reachability checks that are in progress
604
+ *
605
+ * @returns {void}
606
+ */
607
+ }, {
608
+ key: "abortClusterReachability",
609
+ value: function abortClusterReachability() {
610
+ (0, _values.default)(this.clusterReachability).forEach(function (clusterReachability) {
611
+ clusterReachability.abort();
612
+ });
613
+ }
614
+
615
+ /**
616
+ * Helper function for calculating min/max/average values of latency
617
+ *
618
+ * @param {Array<any>} results
619
+ * @param {string} protocol
620
+ * @param {boolean} isVideoMesh
621
+ * @returns {{min:number, max: number, average: number}}
622
+ */
623
+ }, {
624
+ key: "getStatistics",
625
+ value: function getStatistics(results, protocol, isVideoMesh) {
626
+ var values = results.filter(function (result) {
627
+ return result.isVideoMesh === isVideoMesh;
628
+ }).filter(function (result) {
629
+ return result[protocol].result === 'reachable';
630
+ }).map(function (result) {
631
+ return result[protocol].latencyInMilliseconds;
632
+ });
633
+ if (values.length === 0) {
634
+ return {
635
+ min: -1,
636
+ max: -1,
637
+ average: -1
638
+ };
639
+ }
640
+ return {
641
+ min: Math.min.apply(Math, (0, _toConsumableArray2.default)(values)),
642
+ max: Math.max.apply(Math, (0, _toConsumableArray2.default)(values)),
643
+ average: (0, _lodash.mean)(values)
644
+ };
645
+ }
646
+
647
+ /**
648
+ * Sends a metric with all the statistics about how long reachability took
649
+ *
650
+ * @returns {void}
651
+ */
652
+ }, {
653
+ key: "sendMetric",
654
+ value: (function () {
655
+ var _sendMetric = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
656
+ var results, stats;
657
+ return _regenerator.default.wrap(function _callee7$(_context7) {
658
+ while (1) switch (_context7.prev = _context7.next) {
659
+ case 0:
660
+ results = [];
661
+ (0, _values.default)(this.clusterReachability).forEach(function (clusterReachability) {
662
+ results.push(_objectSpread(_objectSpread({}, clusterReachability.getResult()), {}, {
663
+ isVideoMesh: clusterReachability.isVideoMesh
664
+ }));
665
+ });
666
+ stats = {
667
+ vmn: {
668
+ udp: this.getStatistics(results, 'udp', true)
669
+ },
670
+ public: {
671
+ udp: this.getStatistics(results, 'udp', false),
672
+ tcp: this.getStatistics(results, 'tcp', false),
673
+ xtls: this.getStatistics(results, 'xtls', false)
674
+ },
675
+ ipver: {
676
+ // @ts-ignore
677
+ firstIpV4: this.webex.internal.device.ipNetworkDetector.firstIpV4,
678
+ // @ts-ignore
679
+ firstIpV6: this.webex.internal.device.ipNetworkDetector.firstIpV6,
680
+ // @ts-ignore
681
+ firstMdns: this.webex.internal.device.ipNetworkDetector.firstMdns,
682
+ // @ts-ignore
683
+ totalTime: this.webex.internal.device.ipNetworkDetector.totalTime
684
+ },
685
+ trigger: this.lastTrigger
686
+ };
687
+ _metrics.default.sendBehavioralMetric(_constants2.default.REACHABILITY_COMPLETED, _metrics.default.prepareMetricFields(stats));
688
+ case 4:
689
+ case "end":
690
+ return _context7.stop();
691
+ }
692
+ }, _callee7, this);
693
+ }));
694
+ function sendMetric() {
695
+ return _sendMetric.apply(this, arguments);
696
+ }
697
+ return sendMetric;
698
+ }()
699
+ /**
700
+ * Starts all the timers used for various timeouts
701
+ *
702
+ * @returns {void}
703
+ */
704
+ )
705
+ }, {
706
+ key: "startTimers",
707
+ value: function startTimers() {
708
+ var _this3 = this;
709
+ this.vmnTimer = setTimeout(function () {
710
+ _this3.vmnTimer = undefined;
711
+ // if we are only missing VMN results, then we don't want to wait for them any longer
712
+ // as they are likely to fail if users are not on corporate network
713
+ if (_this3.areAllPublicClusterResultsReady()) {
714
+ _loggerProxy.default.logger.log('Reachability:index#startTimers --> Reachability checks timed out (VMN timeout)');
715
+ _this3.resolveReachabilityPromise();
716
+ }
717
+ }, VIDEO_MESH_TIMEOUT * 1000);
718
+ this.publicCloudTimer = setTimeout(function () {
719
+ _this3.publicCloudTimer = undefined;
720
+ _loggerProxy.default.logger.log("Reachability:index#startTimers --> Reachability checks timed out (".concat(DEFAULT_TIMEOUT, "s)"));
721
+
722
+ // resolve the promise, so that the client won't be blocked waiting on meetings.register() for too long
723
+ _this3.resolveReachabilityPromise();
724
+ }, DEFAULT_TIMEOUT * 1000);
725
+ this.overallTimer = setTimeout(function () {
726
+ _this3.overallTimer = undefined;
727
+ _this3.abortClusterReachability();
728
+ _this3.emit({
729
+ file: 'reachability',
730
+ function: 'overallTimer timeout'
731
+ }, 'reachability:done', {});
732
+ _this3.sendMetric();
733
+ _loggerProxy.default.logger.log("Reachability:index#startTimers --> Reachability checks fully timed out (".concat(OVERALL_TIMEOUT, "s)"));
734
+ }, OVERALL_TIMEOUT * 1000);
735
+ }
736
+
737
+ /**
738
+ * Stores given reachability results in local storage
739
+ *
740
+ * @param {ReachabilityResults} results
741
+ * @returns {Promise<void>}
742
+ */
743
+ }, {
744
+ key: "storeResults",
745
+ value: (function () {
746
+ var _storeResults = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(results) {
747
+ return _regenerator.default.wrap(function _callee8$(_context8) {
748
+ while (1) switch (_context8.prev = _context8.next) {
749
+ case 0:
750
+ _context8.next = 2;
751
+ return this.webex.boundedStorage.put(this.namespace, _constants.REACHABILITY.localStorageResult, (0, _stringify.default)(results));
752
+ case 2:
753
+ case "end":
754
+ return _context8.stop();
755
+ }
756
+ }, _callee8, this);
757
+ }));
758
+ function storeResults(_x2) {
759
+ return _storeResults.apply(this, arguments);
760
+ }
761
+ return storeResults;
762
+ }()
763
+ /**
764
+ * Resets all the internal counters that keep track of the results
765
+ *
766
+ * @returns {void}
767
+ */
768
+ )
769
+ }, {
770
+ key: "resetResultCounters",
771
+ value: function resetResultCounters() {
772
+ this.expectedResultsCount.videoMesh.udp = 0;
773
+ this.expectedResultsCount.public.udp = 0;
774
+ this.expectedResultsCount.public.tcp = 0;
775
+ this.expectedResultsCount.public.xtls = 0;
776
+ this.resultsCount.videoMesh.udp = 0;
777
+ this.resultsCount.public.udp = 0;
778
+ this.resultsCount.public.tcp = 0;
779
+ this.resultsCount.public.xtls = 0;
780
+ }
781
+
448
782
  /**
449
783
  * Performs reachability checks for all clusters
450
784
  * @param {ClusterList} clusterList
451
- * @returns {Promise<ReachabilityResults>} reachability check results
785
+ * @returns {Promise<void>} promise that's resolved as soon as the checks are started
452
786
  */
453
787
  }, {
454
788
  key: "performReachabilityChecks",
455
789
  value: (function () {
456
- var _performReachabilityChecks = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(clusterList) {
457
- var _this2 = this;
458
- var results, clusterReachabilityChecks;
459
- return _regenerator.default.wrap(function _callee6$(_context6) {
460
- while (1) switch (_context6.prev = _context6.next) {
790
+ var _performReachabilityChecks = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(clusterList) {
791
+ var _this4 = this;
792
+ var results, isFirstResult;
793
+ return _regenerator.default.wrap(function _callee11$(_context11) {
794
+ while (1) switch (_context11.prev = _context11.next) {
461
795
  case 0:
462
796
  results = {};
797
+ this.clusterReachability = {};
463
798
  if (!(!clusterList || !(0, _keys.default)(clusterList).length)) {
464
- _context6.next = 3;
799
+ _context11.next = 4;
465
800
  break;
466
801
  }
467
- return _context6.abrupt("return", _promise.default.resolve(results));
468
- case 3:
802
+ return _context11.abrupt("return");
803
+ case 4:
469
804
  _loggerProxy.default.logger.log("Reachability:index#performReachabilityChecks --> doing UDP".concat(
470
805
  // @ts-ignore
471
806
  this.webex.config.meetings.experimental.enableTcpReachability ? ',TCP' : '').concat(
472
807
  // @ts-ignore
473
808
  this.webex.config.meetings.experimental.enableTlsReachability ? ',TLS' : '', " reachability checks"));
474
- clusterReachabilityChecks = (0, _keys.default)(clusterList).map(function (key) {
809
+ this.resetResultCounters();
810
+ this.startTimers();
811
+
812
+ // sanitize the urls in the clusterList
813
+ (0, _keys.default)(clusterList).forEach(function (key) {
475
814
  var cluster = clusterList[key];
476
815
 
477
816
  // Linus doesn't support TCP reachability checks on video mesh nodes
478
817
  var includeTcpReachability =
479
818
  // @ts-ignore
480
- _this2.webex.config.meetings.experimental.enableTcpReachability && !cluster.isVideoMesh;
819
+ _this4.webex.config.meetings.experimental.enableTcpReachability && !cluster.isVideoMesh;
481
820
  if (!includeTcpReachability) {
482
821
  cluster.tcp = [];
483
822
  }
823
+
824
+ // Linus doesn't support xTLS reachability checks on video mesh nodes
484
825
  var includeTlsReachability =
485
826
  // @ts-ignore
486
- _this2.webex.config.meetings.experimental.enableTlsReachability && !cluster.isVideoMesh;
827
+ _this4.webex.config.meetings.experimental.enableTlsReachability && !cluster.isVideoMesh;
487
828
  if (!includeTlsReachability) {
488
829
  cluster.xtls = [];
489
830
  }
490
- _this2.clusterReachability[key] = new _clusterReachability.ClusterReachability(key, cluster);
491
- return _this2.clusterReachability[key].start().then(function (result) {
492
- results[key] = result;
493
- results[key].isVideoMesh = cluster.isVideoMesh;
494
- });
831
+
832
+ // initialize the result for this cluster
833
+ results[key] = {
834
+ udp: {
835
+ result: cluster.udp.length > 0 ? 'unreachable' : 'untested'
836
+ },
837
+ tcp: {
838
+ result: cluster.tcp.length > 0 ? 'unreachable' : 'untested'
839
+ },
840
+ xtls: {
841
+ result: cluster.xtls.length > 0 ? 'unreachable' : 'untested'
842
+ },
843
+ isVideoMesh: cluster.isVideoMesh
844
+ };
845
+
846
+ // update expected results counters to include this cluster
847
+ _this4.expectedResultsCount[cluster.isVideoMesh ? 'videoMesh' : 'public'].udp += cluster.udp.length;
848
+ if (!cluster.isVideoMesh) {
849
+ _this4.expectedResultsCount.public.tcp += cluster.tcp.length;
850
+ _this4.expectedResultsCount.public.xtls += cluster.xtls.length;
851
+ }
495
852
  });
496
- _context6.next = 7;
497
- return _promise.default.all(clusterReachabilityChecks);
498
- case 7:
499
- this.logUnreachableClusters();
500
- return _context6.abrupt("return", results);
501
- case 9:
853
+ isFirstResult = {
854
+ udp: true,
855
+ tcp: true,
856
+ xtls: true
857
+ }; // save the initialized results (in case we don't get any "resultReady" events at all)
858
+ _context11.next = 11;
859
+ return this.storeResults(results);
860
+ case 11:
861
+ // now start the reachability on all the clusters
862
+ (0, _keys.default)(clusterList).forEach(function (key) {
863
+ var cluster = clusterList[key];
864
+ _this4.clusterReachability[key] = new _clusterReachability.ClusterReachability(key, cluster);
865
+ _this4.clusterReachability[key].on(_clusterReachability.Events.resultReady, /*#__PURE__*/function () {
866
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(data) {
867
+ var protocol, result, clientMediaIPs, latencyInMilliseconds, areAllResultsReady;
868
+ return _regenerator.default.wrap(function _callee9$(_context9) {
869
+ while (1) switch (_context9.prev = _context9.next) {
870
+ case 0:
871
+ protocol = data.protocol, result = data.result, clientMediaIPs = data.clientMediaIPs, latencyInMilliseconds = data.latencyInMilliseconds;
872
+ if (isFirstResult[protocol]) {
873
+ _this4.emit({
874
+ file: 'reachability',
875
+ function: 'resultReady event handler'
876
+ }, 'reachability:firstResultAvailable', {
877
+ protocol: protocol
878
+ });
879
+ isFirstResult[protocol] = false;
880
+ }
881
+ _this4.resultsCount[cluster.isVideoMesh ? 'videoMesh' : 'public'][protocol] += 1;
882
+ areAllResultsReady = _this4.areAllResultsReady();
883
+ results[key][protocol].result = result;
884
+ results[key][protocol].clientMediaIPs = clientMediaIPs;
885
+ results[key][protocol].latencyInMilliseconds = latencyInMilliseconds;
886
+ _context9.next = 9;
887
+ return _this4.storeResults(results);
888
+ case 9:
889
+ if (areAllResultsReady) {
890
+ clearTimeout(_this4.overallTimer);
891
+ _this4.overallTimer = undefined;
892
+ _this4.emit({
893
+ file: 'reachability',
894
+ function: 'performReachabilityChecks'
895
+ }, 'reachability:done', {});
896
+ _this4.sendMetric();
897
+ _loggerProxy.default.logger.log("Reachability:index#gatherReachability --> Reachability checks fully completed");
898
+ _this4.resolveReachabilityPromise();
899
+ }
900
+ case 10:
901
+ case "end":
902
+ return _context9.stop();
903
+ }
904
+ }, _callee9);
905
+ }));
906
+ return function (_x4) {
907
+ return _ref4.apply(this, arguments);
908
+ };
909
+ }());
910
+
911
+ // clientMediaIps can be updated independently from the results, so we need to listen for them too
912
+ _this4.clusterReachability[key].on(_clusterReachability.Events.clientMediaIpsUpdated, /*#__PURE__*/function () {
913
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(data) {
914
+ return _regenerator.default.wrap(function _callee10$(_context10) {
915
+ while (1) switch (_context10.prev = _context10.next) {
916
+ case 0:
917
+ results[key][data.protocol].clientMediaIPs = data.clientMediaIPs;
918
+ _context10.next = 3;
919
+ return _this4.storeResults(results);
920
+ case 3:
921
+ case "end":
922
+ return _context10.stop();
923
+ }
924
+ }, _callee10);
925
+ }));
926
+ return function (_x5) {
927
+ return _ref5.apply(this, arguments);
928
+ };
929
+ }());
930
+ _this4.clusterReachability[key].start(); // not awaiting on purpose
931
+ });
932
+ case 12:
502
933
  case "end":
503
- return _context6.stop();
934
+ return _context11.stop();
504
935
  }
505
- }, _callee6, this);
936
+ }, _callee11, this);
506
937
  }));
507
- function performReachabilityChecks(_x) {
938
+ function performReachabilityChecks(_x3) {
508
939
  return _performReachabilityChecks.apply(this, arguments);
509
940
  }
510
941
  return performReachabilityChecks;
511
942
  }())
512
943
  }]);
513
944
  return Reachability;
514
- }();
945
+ }(_eventsScope.default);
515
946
  //# sourceMappingURL=index.js.map