瀏覽代碼

fix: Always query the main domain for features. Fixes jitsi/jitsi-meet#8173 (#1428)

* fix: Always query the main domain for features.

* squash: Always use the main domain for turn credentials and ping.

* squash: Fix tests.
dev1
Дамян Минков 4 年之前
父節點
當前提交
968f947627
沒有連結到貢獻者的電子郵件帳戶。
共有 3 個檔案被更改,包括 13 行新增10 行删除
  1. 2
    1
      modules/xmpp/XmppConnection.js
  2. 1
    1
      modules/xmpp/strophe.jingle.js
  3. 10
    8
      modules/xmpp/xmpp.js

+ 2
- 1
modules/xmpp/XmppConnection.js 查看文件

@@ -51,6 +51,7 @@ export default class XmppConnection extends Listenable {
51 51
         super();
52 52
         this._options = {
53 53
             enableWebsocketResume: typeof enableWebsocketResume === 'undefined' ? true : enableWebsocketResume,
54
+            pingOptions: xmppPing,
54 55
             websocketKeepAlive: typeof websocketKeepAlive === 'undefined' ? 4 * 60 * 1000 : Number(websocketKeepAlive)
55 56
         };
56 57
 
@@ -255,7 +256,7 @@ export default class XmppConnection extends Listenable {
255 256
             this._maybeStartWSKeepAlive();
256 257
             this._processDeferredIQs();
257 258
             this._resumeTask.cancel();
258
-            this.ping.startInterval(this.domain);
259
+            this.ping.startInterval(this._options.pingOptions?.domain || this.domain);
259 260
         } else if (status === Strophe.Status.DISCONNECTED) {
260 261
             this.ping.stopInterval();
261 262
 

+ 1
- 1
modules/xmpp/strophe.jingle.js 查看文件

@@ -305,7 +305,7 @@ export default class JingleConnectionPlugin extends ConnectionPlugin {
305 305
         //      https://code.google.com/p/webrtc/issues/detail?id=1650
306 306
         this.connection.sendIQ(
307 307
             $iq({ type: 'get',
308
-                to: this.connection.domain })
308
+                to: this.xmpp.options.hosts.domain })
309 309
                 .c('services', { xmlns: 'urn:xmpp:extdisco:1' }),
310 310
             res => {
311 311
                 const iceservers = [];

+ 10
- 8
modules/xmpp/xmpp.js 查看文件

@@ -106,6 +106,11 @@ export default class XMPP extends Listenable {
106 106
 
107 107
         initStropheNativePlugins();
108 108
 
109
+        const xmppPing = options.xmppPing || {};
110
+
111
+        // let's ping the main domain (in case a guest one is used for the connection)
112
+        xmppPing.domain = options.hosts.domain;
113
+
109 114
         this.connection = createConnection({
110 115
             enableWebsocketResume: options.enableWebsocketResume,
111 116
 
@@ -113,7 +118,7 @@ export default class XMPP extends Listenable {
113 118
             serviceUrl: options.serviceUrl || options.bosh,
114 119
             token,
115 120
             websocketKeepAlive: options.websocketKeepAlive,
116
-            xmppPing: options.xmppPing
121
+            xmppPing
117 122
         });
118 123
 
119 124
         this._initStrophePlugins();
@@ -227,15 +232,12 @@ export default class XMPP extends Listenable {
227 232
             // XmppConnection emits CONNECTED again on reconnect - a good opportunity to clear any "last error" flags
228 233
             this._resetState();
229 234
 
230
-            // Schedule ping ?
231
-            const pingJid = this.connection.domain;
232
-
233 235
             // FIXME no need to do it again on stream resume
234
-            this.caps.getFeaturesAndIdentities(pingJid)
236
+            this.caps.getFeaturesAndIdentities(this.options.hosts.domain)
235 237
                 .then(({ features, identities }) => {
236 238
                     if (!features.has(Strophe.NS.PING)) {
237
-                        logger.error(
238
-                            `Ping NOT supported by ${pingJid} - please enable ping in your XMPP server config`);
239
+                        logger.error(`Ping NOT supported by ${
240
+                            this.options.hosts.domain} - please enable ping in your XMPP server config`);
239 241
                     }
240 242
 
241 243
                     // check for speakerstats
@@ -539,7 +541,7 @@ export default class XMPP extends Listenable {
539 541
     ping(timeout) {
540 542
         return new Promise((resolve, reject) => {
541 543
             this.connection.ping
542
-                    .ping(this.connection.domain, resolve, reject, timeout);
544
+                    .ping(this.connection.options.hosts.domain, resolve, reject, timeout);
543 545
         });
544 546
     }
545 547
 

Loading…
取消
儲存