Просмотр исходного кода

Updates sending region stats, remove unused variable and uses on array variable holding data.

dev1
damencho 9 лет назад
Родитель
Сommit
21d7435245
2 измененных файлов: 17 добавлений и 18 удалений
  1. 7
    11
      JitsiConference.js
  2. 10
    7
      connection_optimization/external_connect.js

+ 7
- 11
JitsiConference.js Просмотреть файл

@@ -76,17 +76,13 @@ function JitsiConference(options) {
76 76
     };
77 77
     this.isMutedByFocus = false;
78 78
 
79
-    // Lets send some general stats useful for debuging problems
80
-    var log = "";
81
-    if(window.jitsiProxyRegion)
82
-        log += "ProxyRegion:" + window.jitsiProxyRegion;
83
-    if(window.jitsiRegion)
84
-        log += (log.length > 0? ", " : "") + "Region: " + window.jitsiRegion;
85
-    if(window.jitsiShard)
86
-        log += (log.length > 0? ", " : "") + "Shard: " + window.jitsiShard;
87
-
88
-    if (log.length > 0)
89
-        Statistics.sendLog(log);
79
+    // Lets send some general stats useful for debugging problems
80
+    if (window.jitsiRegionInfo
81
+            && Object.keys(window.jitsiRegionInfo).length > 0) {
82
+        // remove quotes to make it prettier
83
+        Statistics.sendLog(
84
+            JSON.stringify(window.jitsiRegionInfo).replace(/\"/g, ""));
85
+    }
90 86
 
91 87
     if(JitsiMeetJS.version)
92 88
         Statistics.sendLog("LibJitsiMeet:" + JitsiMeetJS.version);

+ 10
- 7
connection_optimization/external_connect.js Просмотреть файл

@@ -39,13 +39,16 @@ function createConnectionExternally(webserviceUrl, success_callback,
39 39
             if (xhttp.status == HTTP_STATUS_OK) {
40 40
                 try {
41 41
                     var data = JSON.parse(xhttp.responseText);
42
-                    var headers = xhttp.getAllResponseHeaders();
43
-                    window.jitsiProxyRegion
44
-                        = xhttp.getResponseHeader('X-Proxy-Region');
45
-                    window.jitsiRegion
46
-                        = xhttp.getResponseHeader('X-Jitsi-Region');
47
-                    window.jitsiShard
48
-                        = xhttp.getResponseHeader('X-Jitsi-Shard');
42
+
43
+                    window.jitsiRegionInfo = {
44
+                        "ProxyRegion" :
45
+                            xhttp.getResponseHeader('X-Proxy-Region'),
46
+                        "Region" :
47
+                            xhttp.getResponseHeader('X-Jitsi-Region'),
48
+                        "Shard" :
49
+                            xhttp.getResponseHeader('X-Jitsi-Shard')
50
+                    };
51
+
49 52
                     success_callback(data);
50 53
                 } catch (e) {
51 54
                     error_callback(e);

Загрузка…
Отмена
Сохранить