ソースを参照

[RN] Fix handling XMPP connection failures

After the connection is established, it can either be properly disconnected or
fail. We need to make sure to be listening for events for either.
master
Saúl Ibarra Corretgé 7年前
コミット
d557a6505d
1個のファイルの変更8行の追加10行の削除
  1. 8
    10
      react/features/base/connection/actions.native.js

+ 8
- 10
react/features/base/connection/actions.native.js ファイルの表示

108
          * @returns {void}
108
          * @returns {void}
109
          */
109
          */
110
         function _onConnectionDisconnected(message: string) {
110
         function _onConnectionDisconnected(message: string) {
111
-            connection.removeEventListener(
112
-                JitsiConnectionEvents.CONNECTION_DISCONNECTED,
113
-                _onConnectionDisconnected);
114
-
111
+            unsubscribe();
115
             dispatch(_connectionDisconnected(connection, message));
112
             dispatch(_connectionDisconnected(connection, message));
116
         }
113
         }
117
 
114
 
122
          * @returns {void}
119
          * @returns {void}
123
          */
120
          */
124
         function _onConnectionEstablished() {
121
         function _onConnectionEstablished() {
125
-            unsubscribe();
122
+            connection.removeEventListener(
123
+                JitsiConnectionEvents.CONNECTION_ESTABLISHED,
124
+                _onConnectionEstablished);
126
             dispatch(connectionEstablished(connection));
125
             dispatch(connectionEstablished(connection));
127
         }
126
         }
128
 
127
 
141
         function _onConnectionFailed(
140
         function _onConnectionFailed(
142
                 err: string, msg: string, credentials: Object) {
141
                 err: string, msg: string, credentials: Object) {
143
             unsubscribe();
142
             unsubscribe();
144
-            console.error('CONNECTION FAILED:', err, msg);
145
             dispatch(
143
             dispatch(
146
                 connectionFailed(
144
                 connectionFailed(
147
                     connection, {
145
                     connection, {
153
         }
151
         }
154
 
152
 
155
         /**
153
         /**
156
-         * Unsubscribes connection instance from {@code CONNECTION_ESTABLISHED}
157
-         * and {@code CONNECTION_FAILED} events.
154
+         * Unsubscribe the connection instance from
155
+         * {@code CONNECTION_DISCONNECTED} and {@code CONNECTION_FAILED} events.
158
          *
156
          *
159
          * @returns {void}
157
          * @returns {void}
160
          */
158
          */
161
         function unsubscribe() {
159
         function unsubscribe() {
162
             connection.removeEventListener(
160
             connection.removeEventListener(
163
-                JitsiConnectionEvents.CONNECTION_ESTABLISHED,
164
-                _onConnectionEstablished);
161
+                JitsiConnectionEvents.CONNECTION_DISCONNECTED,
162
+                _onConnectionDisconnected);
165
             connection.removeEventListener(
163
             connection.removeEventListener(
166
                 JitsiConnectionEvents.CONNECTION_FAILED,
164
                 JitsiConnectionEvents.CONNECTION_FAILED,
167
                 _onConnectionFailed);
165
                 _onConnectionFailed);

読み込み中…
キャンセル
保存