Browse Source

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

master
hristoterezov 8 years ago
parent
commit
e457906e01
2 changed files with 18 additions and 10 deletions
  1. 13
    8
      modules/statistics/CallStats.js
  2. 5
    2
      modules/statistics/statistics.js

+ 13
- 8
modules/statistics/CallStats.js View File

74
 
74
 
75
     CallStats.initializeFailed = false;
75
     CallStats.initializeFailed = false;
76
     CallStats.initialized = true;
76
     CallStats.initialized = true;
77
+    CallStats.feedbackEnabled = true;
77
 
78
 
78
     // notify callstats about failures if there were any
79
     // notify callstats about failures if there were any
79
     if (CallStats.reportsQueue.length) {
80
     if (CallStats.reportsQueue.length) {
137
  */
138
  */
138
 var CallStats = _try_catch(function(jingleSession, Settings, options) {
139
 var CallStats = _try_catch(function(jingleSession, Settings, options) {
139
     try{
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
         this.session = jingleSession;
144
         this.session = jingleSession;
148
         this.peerconnection = jingleSession.peerconnection.peerconnection;
145
         this.peerconnection = jingleSession.peerconnection.peerconnection;
197
  */
194
  */
198
 CallStats.initializeFailed = false;
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
  * Checks whether we need to re-initialize callstats and starts the process.
204
  * Checks whether we need to re-initialize callstats and starts the process.
202
  * @private
205
  * @private
406
  */
409
  */
407
 CallStats.prototype.sendFeedback = _try_catch(
410
 CallStats.prototype.sendFeedback = _try_catch(
408
 function(overallFeedback, detailedFeedback) {
411
 function(overallFeedback, detailedFeedback) {
409
-    if(!CallStats.initialized) {
412
+    if(!CallStats.feedbackEnabled) {
410
         return;
413
         return;
411
     }
414
     }
412
     var feedbackString =    '{"userID":"' + this.userID + '"' +
415
     var feedbackString =    '{"userID":"' + this.userID + '"' +
523
  * Clears allocated resources.
526
  * Clears allocated resources.
524
  */
527
  */
525
 CallStats.dispose = function () {
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
     CallStats.initialized = false;
532
     CallStats.initialized = false;
528
     CallStats.initializeFailed = false;
533
     CallStats.initializeFailed = false;
529
     CallStats.initializeInProgress = false;
534
     CallStats.initializeInProgress = false;

+ 5
- 2
modules/statistics/statistics.js View File

270
 Statistics.prototype.stopCallStats = function () {
270
 Statistics.prototype.stopCallStats = function () {
271
     if(this.callstats) {
271
     if(this.callstats) {
272
         var index = Statistics.callsStatsInstances.indexOf(this.callstats);
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
         CallStats.dispose();
278
         CallStats.dispose();
276
     }
279
     }
277
 };
280
 };

Loading…
Cancel
Save