@ray-js/robot-data-stream 0.0.10-beta-4 → 0.0.10-beta-5

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.
@@ -191,6 +191,7 @@ export class SweeperP2p extends P2pApi {
191
191
  } = data;
192
192
  if (status < 0) {
193
193
  log4js.info('receive disconnect notice ==>', status);
194
+ this.isConnected = false;
194
195
  if (!this.isConnecting) {
195
196
  this.reconnectP2p(() => {
196
197
  // 重连之后重新开启文件下载, 这里的成功不需要注册断开事件
@@ -291,6 +292,7 @@ export class SweeperP2p extends P2pApi {
291
292
  * 注册下载有关的监听
292
293
  */
293
294
  registerP2pDownloadEvent = () => {
295
+ log4js.info('registerP2pDownloadEvent ==>');
294
296
  if (shouldDownloadStream) {
295
297
  // p2p数据流监听
296
298
  this.offP2pStreamPacketReceive = this.onP2pStreamPacketReceive(this.p2pStreamPacketReceiveCallback);
@@ -311,8 +313,7 @@ export class SweeperP2p extends P2pApi {
311
313
  * 移除下载有关的监听
312
314
  */
313
315
  removeP2pDownloadEvent = () => {
314
- this.offFileDownloadComplete && this.offFileDownloadComplete();
315
- this.offP2pStreamPacketReceive && this.offP2pStreamPacketReceive();
316
+ log4js.info('removeP2pDownloadEvent ==>');
316
317
  if (shouldDownloadStream) {
317
318
  [...this.packetSerialNumberCacheMap.keys()].forEach(key => {
318
319
  this.packetSerialNumberCacheMap.set(key, -1);
@@ -326,6 +327,8 @@ export class SweeperP2p extends P2pApi {
326
327
  } else {
327
328
  this.cacheData = {};
328
329
  }
330
+ this.offFileDownloadComplete && this.offFileDownloadComplete();
331
+ this.offP2pStreamPacketReceive && this.offP2pStreamPacketReceive();
329
332
 
330
333
  // this.offDownLoadProgressUpdate && this.offDownLoadProgressUpdate();
331
334
  // this.offTotalDownLoadProgressUpdate && this.offTotalDownLoadProgressUpdate();
@@ -363,6 +366,7 @@ export class SweeperP2p extends P2pApi {
363
366
  let {
364
367
  fileName
365
368
  } = data;
369
+ log4js.info(`p2pStreamPacketReceiveCallback: ${fileName}, ${fileSerialNumber}, ${packetType}`);
366
370
 
367
371
  // 因为XXXX_YYYYY会被替换为坐标值,所以这里需要替换一下
368
372
 
@@ -569,7 +573,8 @@ export class SweeperP2p extends P2pApi {
569
573
  stopObserverSweeperDataByP2P = async () => {
570
574
  try {
571
575
  this.removeP2pDownloadEvent();
572
- this.cancelDownloadTask();
576
+ // 没有必要cancelDownloadTask,只需要调用断连
577
+ // this.cancelDownloadTask();
573
578
 
574
579
  // 先销毁断开监听
575
580
  typeof this.offSessionStatusChange === 'function' && this.offSessionStatusChange();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/robot-data-stream",
3
- "version": "0.0.10-beta-4",
3
+ "version": "0.0.10-beta-5",
4
4
  "description": "扫地机P2P数据流标准化组件",
5
5
  "main": "lib/index",
6
6
  "files": [