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

feat(base/conference): CONFERENCE_FAILED on CONNECTION_FAILED

Emits CONFERENCE_FAILED in response to CONNECTION_FAILED event
which then triggers JitsiConference.leave() through the middleware
processing. Also base/conference state will be adjusted. It is to have
a consistent redux state in which both connection and conference are
failed. It could happen that in a buggy environment the XMPP connection
is dropped, but the media is still flowing which would result in weird
user experience.
master
paweldomas 7 лет назад
Родитель
Сommit
57b302da3e
2 измененных файлов: 63 добавлений и 2 удалений
  1. 2
    1
      react/features/base/conference/actions.js
  2. 61
    1
      react/features/base/conference/middleware.js

+ 2
- 1
react/features/base/conference/actions.js Просмотреть файл

199
         // Make the error resemble an Error instance (to the extent that
199
         // Make the error resemble an Error instance (to the extent that
200
         // jitsi-meet needs it).
200
         // jitsi-meet needs it).
201
         error: {
201
         error: {
202
-            name: error
202
+            name: error,
203
+            recoverable: undefined
203
         }
204
         }
204
     };
205
     };
205
 }
206
 }

+ 61
- 1
react/features/base/conference/middleware.js Просмотреть файл

7
     createPinnedEvent,
7
     createPinnedEvent,
8
     sendAnalytics
8
     sendAnalytics
9
 } from '../../analytics';
9
 } from '../../analytics';
10
-import { CONNECTION_ESTABLISHED } from '../connection';
10
+import { CONNECTION_ESTABLISHED, CONNECTION_FAILED } from '../connection';
11
 import { setVideoMuted, VIDEO_MUTISM_AUTHORITY } from '../media';
11
 import { setVideoMuted, VIDEO_MUTISM_AUTHORITY } from '../media';
12
 import {
12
 import {
13
     getLocalParticipant,
13
     getLocalParticipant,
20
 import { TRACK_ADDED, TRACK_REMOVED } from '../tracks';
20
 import { TRACK_ADDED, TRACK_REMOVED } from '../tracks';
21
 
21
 
22
 import {
22
 import {
23
+    conferenceFailed,
23
     conferenceLeft,
24
     conferenceLeft,
24
     createConference,
25
     createConference,
25
     setLastN,
26
     setLastN,
62
     case CONNECTION_ESTABLISHED:
63
     case CONNECTION_ESTABLISHED:
63
         return _connectionEstablished(store, next, action);
64
         return _connectionEstablished(store, next, action);
64
 
65
 
66
+    case CONNECTION_FAILED:
67
+        return _connectionFailed(store, next, action);
68
+
65
     case DATA_CHANNEL_OPENED:
69
     case DATA_CHANNEL_OPENED:
66
         return _syncReceiveVideoQuality(store, next, action);
70
         return _syncReceiveVideoQuality(store, next, action);
67
 
71
 
168
     return result;
172
     return result;
169
 }
173
 }
170
 
174
 
175
+/**
176
+ * Notifies the feature base/conference that the action
177
+ * {@code CONNECTION_FAILED} is being dispatched within a specific redux
178
+ * store.
179
+ *
180
+ * @param {Store} store - The redux store in which the specified {@code action}
181
+ * is being dispatched.
182
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
183
+ * specified {@code action} to the specified {@code store}.
184
+ * @param {Action} action - The redux action {@code CONNECTION_FAILED} which is
185
+ * being dispatched in the specified {@code store}.
186
+ * @private
187
+ * @returns {Object} The value returned by {@code next(action)}.
188
+ */
189
+function _connectionFailed({ dispatch, getState }, next, action) {
190
+    const result = next(action);
191
+
192
+    // FIXME: Workaround for the web version. Currently, the creation of the
193
+    // conference is handled by /conference.js and appropriate failure handlers
194
+    // are set there.
195
+    if (typeof APP === 'undefined') {
196
+        const { connection } = action;
197
+        const { error } = action;
198
+
199
+        forEachConference(getState, conference => {
200
+            // It feels that it would make things easier if JitsiConference
201
+            // in lib-jitsi-meet would monitor it's connection and emit
202
+            // CONFERENCE_FAILED when it's dropped. It has more knowledge on
203
+            // whether it can recover or not. But because the reload screen
204
+            // and the retry logic is implemented in the app maybe it can be
205
+            // left this way for now.
206
+            if (conference.getConnection() === connection) {
207
+                // XXX Note that on mobile the error type passed to
208
+                // connectionFailed is always an object with .name property.
209
+                // This fact needs to be checked prior to enabling this logic on
210
+                // web.
211
+                const conferenceAction
212
+                    = conferenceFailed(conference, error.name);
213
+
214
+                // Copy the recoverable flag if set on the CONNECTION_FAILED
215
+                // action to not emit recoverable action caused by
216
+                // a non-recoverable one.
217
+                if (typeof error.recoverable !== 'undefined') {
218
+                    conferenceAction.error.recoverable = error.recoverable;
219
+                }
220
+
221
+                dispatch(conferenceAction);
222
+            }
223
+
224
+            return true;
225
+        });
226
+    }
227
+
228
+    return result;
229
+}
230
+
171
 /**
231
 /**
172
  * Notifies the feature base/conference that the action {@code PIN_PARTICIPANT}
232
  * Notifies the feature base/conference that the action {@code PIN_PARTICIPANT}
173
  * is being dispatched within a specific redux store. Pins the specified remote
233
  * is being dispatched within a specific redux store. Pins the specified remote

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