|
|
@@ -57,7 +57,9 @@ ReducerRegistry.register(
|
|
57
|
57
|
function _connectionDisconnected(
|
|
58
|
58
|
state: Object,
|
|
59
|
59
|
{ connection }: { connection: Object }) {
|
|
60
|
|
- if (state.connection !== connection) {
|
|
|
60
|
+ const connection_ = _getCurrentConnection(state);
|
|
|
61
|
+
|
|
|
62
|
+ if (connection_ !== connection) {
|
|
61
|
63
|
return state;
|
|
62
|
64
|
}
|
|
63
|
65
|
|
|
|
@@ -104,11 +106,7 @@ function _connectionFailed(
|
|
104
|
106
|
connection: Object,
|
|
105
|
107
|
error: ConnectionFailedError
|
|
106
|
108
|
}) {
|
|
107
|
|
-
|
|
108
|
|
- // The current (similar to getCurrentConference in
|
|
109
|
|
- // base/conference/functions.js) connection which is connecting or
|
|
110
|
|
- // connected:
|
|
111
|
|
- const connection_ = state.connection || state.connecting;
|
|
|
109
|
+ const connection_ = _getCurrentConnection(state);
|
|
112
|
110
|
|
|
113
|
111
|
if (connection_ && connection_ !== connection) {
|
|
114
|
112
|
return state;
|
|
|
@@ -139,6 +137,11 @@ function _connectionWillConnect(
|
|
139
|
137
|
{ connection }: { connection: Object }) {
|
|
140
|
138
|
return assign(state, {
|
|
141
|
139
|
connecting: connection,
|
|
|
140
|
+
|
|
|
141
|
+ // We don't care if the previous connection has been closed already,
|
|
|
142
|
+ // because it's an async process and there's no guarantee if it'll be
|
|
|
143
|
+ // done before the new one is established.
|
|
|
144
|
+ connection: undefined,
|
|
142
|
145
|
error: undefined,
|
|
143
|
146
|
passwordRequired: undefined
|
|
144
|
147
|
});
|
|
|
@@ -188,6 +191,19 @@ function _constructOptions(locationURL: URL) {
|
|
188
|
191
|
};
|
|
189
|
192
|
}
|
|
190
|
193
|
|
|
|
194
|
+/**
|
|
|
195
|
+ * The current (similar to getCurrentConference in base/conference/functions.js)
|
|
|
196
|
+ * connection which is {@code connection} or {@code connecting}.
|
|
|
197
|
+ *
|
|
|
198
|
+ * @param {Object} baseConnectionState - The current state of the
|
|
|
199
|
+ * {@code 'base/connection'} feature.
|
|
|
200
|
+ * @returns {JitsiConnection} - The current {@code JitsiConnection} if any.
|
|
|
201
|
+ * @private
|
|
|
202
|
+ */
|
|
|
203
|
+function _getCurrentConnection(baseConnectionState: Object): ?Object {
|
|
|
204
|
+ return baseConnectionState.connection || baseConnectionState.connecting;
|
|
|
205
|
+}
|
|
|
206
|
+
|
|
191
|
207
|
/**
|
|
192
|
208
|
* Reduces a specific redux action {@link SET_LOCATION_URL} of the feature
|
|
193
|
209
|
* base/connection.
|