@ray-js/robot-data-stream 0.0.12-beta-10 → 0.0.12-beta-11
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.
- package/lib/api/p2pApi.js +9 -1
- package/package.json +1 -1
package/lib/api/p2pApi.js
CHANGED
|
@@ -26,11 +26,16 @@ export default class P2pApi {
|
|
|
26
26
|
* 并清除定时器
|
|
27
27
|
*/
|
|
28
28
|
// this.isConnected = false;
|
|
29
|
-
if (this.isConnected
|
|
29
|
+
if (this.isConnected) {
|
|
30
30
|
return logger('info', {
|
|
31
31
|
msg: 'p2p isConnected or isConnecting'
|
|
32
32
|
}, this.onLogger);
|
|
33
33
|
}
|
|
34
|
+
if (this.isConnecting) {
|
|
35
|
+
return logger('info', {
|
|
36
|
+
msg: 'p2p isConnecting'
|
|
37
|
+
}, this.onLogger);
|
|
38
|
+
}
|
|
34
39
|
// if (!this.isConnected) {
|
|
35
40
|
logger('info', {
|
|
36
41
|
msg: `${source} start p2p reconnect ==> ${moment().format('YYYY-MM-DD HH:mm:ss')}`
|
|
@@ -117,6 +122,7 @@ export default class P2pApi {
|
|
|
117
122
|
logger('warn', {
|
|
118
123
|
msg: `p2p connectDevice failed ==> ${JSON.stringify(params.innerError)}`
|
|
119
124
|
}, this.onLogger);
|
|
125
|
+
this.isConnecting = false;
|
|
120
126
|
typeof failCb === 'function' && failCb();
|
|
121
127
|
resolve(false);
|
|
122
128
|
},
|
|
@@ -126,6 +132,8 @@ export default class P2pApi {
|
|
|
126
132
|
}
|
|
127
133
|
});
|
|
128
134
|
} catch (e) {
|
|
135
|
+
this.isConnecting = false;
|
|
136
|
+
this.isConnected = false;
|
|
129
137
|
logger('error', {
|
|
130
138
|
msg: 'p2p connectDevice occur an error ==>',
|
|
131
139
|
e
|