瀏覽代碼

Fixes the issue with not able to send feedback after JitsiConference.leave

master
hristoterezov 8 年之前
父節點
當前提交
e457906e01
共有 2 個文件被更改,包括 18 次插入10 次删除
  1. 13
    8
      modules/statistics/CallStats.js
  2. 5
    2
      modules/statistics/statistics.js

+ 13
- 8
modules/statistics/CallStats.js 查看文件

@@ -74,6 +74,7 @@ function initCallback (err, msg) {
74 74
 
75 75
     CallStats.initializeFailed = false;
76 76
     CallStats.initialized = true;
77
+    CallStats.feedbackEnabled = true;
77 78
 
78 79
     // notify callstats about failures if there were any
79 80
     if (CallStats.reportsQueue.length) {
@@ -137,12 +138,8 @@ function _try_catch (f) {
137 138
  */
138 139
 var CallStats = _try_catch(function(jingleSession, Settings, options) {
139 140
     try{
140
-        //check weather that should work with more than 1 peerconnection
141
-        if(!callStats) {
142
-            callStats = new callstats($, io, jsSHA);
143
-        } else {
144
-            return;
145
-        }
141
+        CallStats.feedbackEnabled = false;
142
+        callStats = new callstats($, io, jsSHA);
146 143
 
147 144
         this.session = jingleSession;
148 145
         this.peerconnection = jingleSession.peerconnection.peerconnection;
@@ -197,6 +194,12 @@ CallStats.initializeInProgress = false;
197 194
  */
198 195
 CallStats.initializeFailed = false;
199 196
 
197
+/**
198
+ * Shows weather sending feedback is enabled or not
199
+ * @type {boolean}
200
+ */
201
+CallStats.feedbackEnabled = false;
202
+
200 203
 /**
201 204
  * Checks whether we need to re-initialize callstats and starts the process.
202 205
  * @private
@@ -406,7 +409,7 @@ CallStats.prototype.sendIceConnectionFailedEvent = _try_catch(function (pc, cs){
406 409
  */
407 410
 CallStats.prototype.sendFeedback = _try_catch(
408 411
 function(overallFeedback, detailedFeedback) {
409
-    if(!CallStats.initialized) {
412
+    if(!CallStats.feedbackEnabled) {
410 413
         return;
411 414
     }
412 415
     var feedbackString =    '{"userID":"' + this.userID + '"' +
@@ -523,7 +526,9 @@ CallStats.sendApplicationLog = _try_catch(function (e, cs) {
523 526
  * Clears allocated resources.
524 527
  */
525 528
 CallStats.dispose = function () {
526
-    callStats = null;
529
+    // The next line is commented because we need to be able to send feedback
530
+    // even after the conference has been destroyed.
531
+    // callStats = null;
527 532
     CallStats.initialized = false;
528 533
     CallStats.initializeFailed = false;
529 534
     CallStats.initializeInProgress = false;

+ 5
- 2
modules/statistics/statistics.js 查看文件

@@ -270,8 +270,11 @@ Statistics.prototype.startCallStats = function (session, settings) {
270 270
 Statistics.prototype.stopCallStats = function () {
271 271
     if(this.callstats) {
272 272
         var index = Statistics.callsStatsInstances.indexOf(this.callstats);
273
-        Statistics.callsStatsInstances.splice(index, 1);
274
-        this.callstats = null;
273
+        if(index > -1)
274
+            Statistics.callsStatsInstances.splice(index, 1);
275
+        // The next line is commented because we need to be able to send
276
+        // feedback even after the conference has been destroyed.
277
+        // this.callstats = null;
275 278
         CallStats.dispose();
276 279
     }
277 280
 };

Loading…
取消
儲存