podasync-ws-only 2.9.0-snapshot.3 → 2.9.0-snapshot.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
// }
|
|
101
101
|
|
|
102
102
|
const reconnOnClose = {
|
|
103
|
-
value:
|
|
104
|
-
oldValue:
|
|
103
|
+
value: false,
|
|
104
|
+
oldValue: null,
|
|
105
105
|
get() {
|
|
106
106
|
return reconnOnClose.value;
|
|
107
107
|
},
|
|
@@ -194,10 +194,10 @@
|
|
|
194
194
|
}
|
|
195
195
|
});
|
|
196
196
|
socket.on('close', function (event) {
|
|
197
|
-
console.log("on.close", reconnOnClose.get(), reconnOnClose.getOld());
|
|
198
197
|
isSocketOpen = false;
|
|
199
198
|
isDeviceRegister = false;
|
|
200
199
|
oldPeerId = peerId;
|
|
200
|
+
socketState = socketStateType.CLOSED;
|
|
201
201
|
|
|
202
202
|
// socketState = socketStateType.CLOSED;
|
|
203
203
|
//
|
|
@@ -220,7 +220,6 @@
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
logLevel.debug && console.debug("[Async][async.js] on socket close, retryStep:", retryStep.get());
|
|
223
|
-
socketState = socketStateType.CLOSED;
|
|
224
223
|
fireEvent('stateChange', {
|
|
225
224
|
socketState: socketState,
|
|
226
225
|
timeUntilReconnect: 1000 * retryStep.get(),
|
|
@@ -780,7 +779,7 @@
|
|
|
780
779
|
|
|
781
780
|
// let tmpReconnectOnClose = reconnectOnClose;
|
|
782
781
|
// reconnectOnClose = false;
|
|
783
|
-
reconnOnClose.setOld(reconnOnClose.get());
|
|
782
|
+
if (reconnOnClose.getOld() == null) reconnOnClose.setOld(reconnOnClose.get());
|
|
784
783
|
reconnOnClose.set(false);
|
|
785
784
|
retryStep.set(0);
|
|
786
785
|
if (protocol === "websocket") socket.connect();else if (protocol == "webrtc") webRTCClass.connect();
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
config.timeoutIds.third = setTimeout(() => {
|
|
55
55
|
logLevel.debug && console.debug("[Async][Socket.js] Force closing socket.");
|
|
56
56
|
onCloseHandler(null);
|
|
57
|
-
socket.close();
|
|
57
|
+
if (socket) socket.close();
|
|
58
58
|
}, 2000);
|
|
59
59
|
}, 2000);
|
|
60
60
|
}, 8000);
|
|
@@ -77,7 +77,6 @@
|
|
|
77
77
|
},
|
|
78
78
|
connect = function () {
|
|
79
79
|
try {
|
|
80
|
-
console.log("socket.connect()");
|
|
81
80
|
if (socket && socket.readyState == 1) {
|
|
82
81
|
return;
|
|
83
82
|
}
|
|
@@ -205,7 +204,7 @@
|
|
|
205
204
|
};
|
|
206
205
|
this.close = function () {
|
|
207
206
|
logLevel.debug && console.debug("[Async][Socket.js] Closing socket by call to this.close");
|
|
208
|
-
socket.close();
|
|
207
|
+
if (socket) socket.close();
|
|
209
208
|
onCloseHandler(null);
|
|
210
209
|
socketWatchTimeout && clearTimeout(socketWatchTimeout);
|
|
211
210
|
};
|
package/package.json
CHANGED
package/src/network/async.js
CHANGED
|
@@ -106,8 +106,8 @@
|
|
|
106
106
|
// }
|
|
107
107
|
|
|
108
108
|
const reconnOnClose = {
|
|
109
|
-
value:
|
|
110
|
-
oldValue:
|
|
109
|
+
value: false,
|
|
110
|
+
oldValue: null,
|
|
111
111
|
get() {
|
|
112
112
|
return reconnOnClose.value;
|
|
113
113
|
},
|
|
@@ -213,6 +213,7 @@
|
|
|
213
213
|
isSocketOpen = false;
|
|
214
214
|
isDeviceRegister = false;
|
|
215
215
|
oldPeerId = peerId;
|
|
216
|
+
socketState = socketStateType.CLOSED;
|
|
216
217
|
|
|
217
218
|
// socketState = socketStateType.CLOSED;
|
|
218
219
|
//
|
|
@@ -239,7 +240,6 @@
|
|
|
239
240
|
|
|
240
241
|
logLevel.debug && console.debug("[Async][async.js] on socket close, retryStep:", retryStep.get());
|
|
241
242
|
|
|
242
|
-
socketState = socketStateType.CLOSED;
|
|
243
243
|
fireEvent('stateChange', {
|
|
244
244
|
socketState: socketState,
|
|
245
245
|
timeUntilReconnect: 1000 * retryStep.get(),
|
|
@@ -907,7 +907,9 @@
|
|
|
907
907
|
|
|
908
908
|
// let tmpReconnectOnClose = reconnectOnClose;
|
|
909
909
|
// reconnectOnClose = false;
|
|
910
|
-
|
|
910
|
+
if(reconnOnClose.getOld() == null)
|
|
911
|
+
reconnOnClose.setOld(reconnOnClose.get());
|
|
912
|
+
|
|
911
913
|
reconnOnClose.set(false);
|
|
912
914
|
retryStep.set(0);
|
|
913
915
|
|
package/src/network/socket.js
CHANGED
|
@@ -56,7 +56,8 @@
|
|
|
56
56
|
config.timeoutIds.third = setTimeout(()=>{
|
|
57
57
|
logLevel.debug && console.debug("[Async][Socket.js] Force closing socket.");
|
|
58
58
|
onCloseHandler(null);
|
|
59
|
-
socket
|
|
59
|
+
if(socket)
|
|
60
|
+
socket.close();
|
|
60
61
|
}, 2000);
|
|
61
62
|
}, 2000);
|
|
62
63
|
}, 8000);
|
|
@@ -224,7 +225,8 @@
|
|
|
224
225
|
|
|
225
226
|
this.close = function() {
|
|
226
227
|
logLevel.debug && console.debug("[Async][Socket.js] Closing socket by call to this.close");
|
|
227
|
-
socket
|
|
228
|
+
if(socket)
|
|
229
|
+
socket.close();
|
|
228
230
|
onCloseHandler(null);
|
|
229
231
|
socketWatchTimeout && clearTimeout(socketWatchTimeout);
|
|
230
232
|
}
|