浏览代码

feat(JitsiConnection) force reload page on shard changes.

master
Jaya Allamsetty 6 个月前
父节点
当前提交
864d0f0199

+ 0
- 12
JitsiConference.js 查看文件

@@ -2906,18 +2906,6 @@ JitsiConference.prototype.isConnectionInterrupted = function() {
2906 2906
         ? this.isP2PConnectionInterrupted : this.isJvbConnectionInterrupted;
2907 2907
 };
2908 2908
 
2909
-/**
2910
- * Handles {@link XMPPEvents.CONNECTION_RESTARTED} event. This happens when the bridge goes down
2911
- * and Jicofo moves conferences away to a different bridge.
2912
- * @param {JingleSessionPC} session
2913
- * @private
2914
- */
2915
-JitsiConference.prototype._onConferenceRestarted = function(session) {
2916
-    if (!session.isP2P && this.options.config.enableForcedReload) {
2917
-        this.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.CONFERENCE_RESTARTED);
2918
-    }
2919
-};
2920
-
2921 2909
 /**
2922 2910
  * Handles {@link XMPPEvents.CONNECTION_INTERRUPTED}
2923 2911
  * @param {JingleSessionPC} session

+ 0
- 5
JitsiConferenceEventManager.js 查看文件

@@ -193,11 +193,6 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
193 193
         XMPPEvents.BRIDGE_DOWN,
194 194
         () => Statistics.sendAnalytics(createBridgeDownEvent()));
195 195
 
196
-    chatRoom.addListener(XMPPEvents.CONNECTION_RESTARTED,
197
-        jingleSession => {
198
-            conference._onConferenceRestarted(jingleSession);
199
-        });
200
-
201 196
     this.chatRoomForwarder.forward(XMPPEvents.RESERVATION_ERROR,
202 197
         JitsiConferenceEvents.CONFERENCE_FAILED,
203 198
         JitsiConferenceErrors.RESERVATION_ERROR);

+ 2
- 0
JitsiConnectionErrors.spec.ts 查看文件

@@ -10,6 +10,7 @@ describe( "/JitsiConnectionErrors members", () => {
10 10
         OTHER_ERROR,
11 11
         PASSWORD_REQUIRED,
12 12
         SERVER_ERROR,
13
+        SHARD_CHANGED_ERROR,
13 14
         JitsiConnectionErrors,
14 15
         ...others
15 16
     } = exported;
@@ -30,6 +31,7 @@ describe( "/JitsiConnectionErrors members", () => {
30 31
         expect( JitsiConnectionErrors.OTHER_ERROR ).toBe( 'connection.otherError' );
31 32
         expect( JitsiConnectionErrors.PASSWORD_REQUIRED ).toBe( 'connection.passwordRequired' );
32 33
         expect( JitsiConnectionErrors.SERVER_ERROR ).toBe( 'connection.serverError' );
34
+        expect( JitsiConnectionErrors.SHARD_CHANGED_ERROR ).toBe( 'connection.shardChangedError' );
33 35
     } );
34 36
 
35 37
     it( "unknown members", () => {

+ 7
- 1
JitsiConnectionErrors.ts 查看文件

@@ -41,7 +41,12 @@ export enum JitsiConnectionErrors {
41 41
      * Indicates that the connection was dropped, because of too many 5xx HTTP
42 42
      * errors on BOSH requests.
43 43
      */
44
-    SERVER_ERROR = 'connection.serverError'
44
+    SERVER_ERROR = 'connection.serverError',
45
+
46
+    /**
47
+     * Indicates that the connection was dropped, because of conference being moved to a new shard.
48
+     */
49
+    SHARD_CHANGED_ERROR = 'connection.shardChangedError'
45 50
 }
46 51
 
47 52
 // exported for backward compatibility
@@ -51,3 +56,4 @@ export const NOT_LIVE_ERROR = JitsiConnectionErrors.NOT_LIVE_ERROR;
51 56
 export const OTHER_ERROR = JitsiConnectionErrors.OTHER_ERROR;
52 57
 export const PASSWORD_REQUIRED = JitsiConnectionErrors.PASSWORD_REQUIRED;
53 58
 export const SERVER_ERROR = JitsiConnectionErrors.SERVER_ERROR;
59
+export const SHARD_CHANGED_ERROR = JitsiConnectionErrors.SHARD_CHANGED_ERROR;

+ 13
- 6
modules/xmpp/xmpp.js 查看文件

@@ -196,12 +196,19 @@ export default class XMPP extends Listenable {
196 196
             };
197 197
             /* eslint-enable camelcase */
198 198
 
199
-            this.eventEmitter.emit(
200
-                JitsiConnectionEvents.CONNECTION_FAILED,
201
-                JitsiConnectionErrors.OTHER_ERROR,
202
-                undefined,
203
-                undefined,
204
-                details);
199
+            if (this.options.testing?.enableGracefulReconnect) {
200
+                this.eventEmitter.emit(
201
+                    JitsiConnectionEvents.CONNECTION_FAILED,
202
+                    JitsiConnectionErrors.SHARD_CHANGED_ERROR
203
+                );
204
+            } else {
205
+                this.eventEmitter.emit(
206
+                    JitsiConnectionEvents.CONNECTION_FAILED,
207
+                    JitsiConnectionErrors.OTHER_ERROR,
208
+                    undefined,
209
+                    undefined,
210
+                    details);
211
+            }
205 212
         });
206 213
 
207 214
         this._initStrophePlugins();

+ 0
- 1
service/xmpp/XMPPEvents.spec.ts 查看文件

@@ -27,7 +27,6 @@ describe( "/service/xmpp/XMPPEvents members", () => {
27 27
         expect( XMPPEvents.CONNECTION_INTERRUPTED ).toBe( 'xmpp.connection.interrupted' );
28 28
         expect( XMPPEvents.CONNECTION_RESTORED ).toBe( 'xmpp.connection.restored' );
29 29
         expect( XMPPEvents.CONNECTION_ICE_FAILED ).toBe( 'xmpp.connection.ice.failed' );
30
-        expect( XMPPEvents.CONNECTION_RESTARTED ).toBe( 'xmpp.connection.restart' );
31 30
         expect( XMPPEvents.CONNECTION_STATUS_CHANGED ).toBe( 'xmpp.connection.status.changed' );
32 31
         expect( XMPPEvents.DISPLAY_NAME_CHANGED ).toBe( 'xmpp.display_name_changed' );
33 32
         expect( XMPPEvents.EMUC_ROOM_ADDED ).toBe( 'xmpp.emuc_room_added' );

+ 0
- 4
service/xmpp/XMPPEvents.ts 查看文件

@@ -100,10 +100,6 @@ export enum XMPPEvents {
100 100
     // interrupted. This should go to the RTC module.
101 101
     CONNECTION_INTERRUPTED = 'xmpp.connection.interrupted',
102 102
 
103
-    // Designates an event indicating that the call has been migrated to a different
104
-    // bridge and that the client needs to be restarted for a successful transition.
105
-    CONNECTION_RESTARTED = 'xmpp.connection.restart',
106
-
107 103
     // Designates an event indicating that the media (ICE) connection was
108 104
     // restored. This should go to the RTC module.
109 105
     CONNECTION_RESTORED = 'xmpp.connection.restored',

+ 0
- 1
types/hand-crafted/service/xmpp/XMPPEvents.d.ts 查看文件

@@ -14,7 +14,6 @@
14 14
   CONNECTION_INTERRUPTED = 'xmpp.connection.interrupted',
15 15
   CONNECTION_RESTORED = 'xmpp.connection.restored',
16 16
   CONNECTION_ICE_FAILED = 'xmpp.connection.ice.failed',
17
-  CONNECTION_RESTARTED = 'xmpp.connection.restart',
18 17
   CONNECTION_STATUS_CHANGED = 'xmpp.connection.status.changed',
19 18
   DISPLAY_NAME_CHANGED = 'xmpp.display_name_changed',
20 19
   EMUC_ROOM_ADDED = 'xmpp.emuc_room_added',

正在加载...
取消
保存