egos-transfer 0.2.8 → 0.2.10
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/dist/peer-transfer.js +8 -9
- package/package.json +1 -1
- package/src/peer-transfer.ts +2 -2
package/dist/peer-transfer.js
CHANGED
|
@@ -60,6 +60,7 @@ class PeerTransfer {
|
|
|
60
60
|
if (((_a = this.peer) === null || _a === void 0 ? void 0 : _a.open) && !force) {
|
|
61
61
|
return this.peer;
|
|
62
62
|
}
|
|
63
|
+
console.info('create peer', Date.now());
|
|
63
64
|
this.destroyPeer();
|
|
64
65
|
yield this.reloadConfig();
|
|
65
66
|
const peer = new peerjs_1.Peer(this.peerId, Object.assign(Object.assign({}, this.peerConfig), { pingInterval: 9000 }));
|
|
@@ -165,7 +166,6 @@ class PeerTransfer {
|
|
|
165
166
|
}
|
|
166
167
|
break;
|
|
167
168
|
default:
|
|
168
|
-
console.log('unknown socket message type', message);
|
|
169
169
|
break;
|
|
170
170
|
}
|
|
171
171
|
}
|
|
@@ -466,7 +466,8 @@ class PeerTransfer {
|
|
|
466
466
|
// ── Router integration ──────────────────────────────────────────
|
|
467
467
|
onRequest(conn, message) {
|
|
468
468
|
return __awaiter(this, void 0, void 0, function* () {
|
|
469
|
-
|
|
469
|
+
console.info('onRequest===>', message.route);
|
|
470
|
+
// this.resetIdleTimer();
|
|
470
471
|
try {
|
|
471
472
|
yield this.router.run(conn, message);
|
|
472
473
|
}
|
|
@@ -477,7 +478,8 @@ class PeerTransfer {
|
|
|
477
478
|
}
|
|
478
479
|
onResponse(_conn, message) {
|
|
479
480
|
return __awaiter(this, void 0, void 0, function* () {
|
|
480
|
-
|
|
481
|
+
console.info('onResponse<====', message.route);
|
|
482
|
+
// this.resetIdleTimer();
|
|
481
483
|
// 优先检查 health check ping 回调
|
|
482
484
|
const cb = this.requests.get(message.requestId);
|
|
483
485
|
if (cb) {
|
|
@@ -525,7 +527,7 @@ class PeerTransfer {
|
|
|
525
527
|
}
|
|
526
528
|
this.heartbeatTimer = setTimeout(() => {
|
|
527
529
|
if (!this.destroyed) {
|
|
528
|
-
this.reconnect(
|
|
530
|
+
this.reconnect();
|
|
529
531
|
}
|
|
530
532
|
}, HEARTBEAT_TIMEOUT);
|
|
531
533
|
}
|
|
@@ -573,11 +575,8 @@ class PeerTransfer {
|
|
|
573
575
|
var _a;
|
|
574
576
|
(_a = this.peer) === null || _a === void 0 ? void 0 : _a.socket.send({
|
|
575
577
|
type: 'RELOAD',
|
|
576
|
-
payload: {
|
|
577
|
-
|
|
578
|
-
src: this.peerId,
|
|
579
|
-
dst: peerId,
|
|
580
|
-
},
|
|
578
|
+
payload: {},
|
|
579
|
+
dst: peerId,
|
|
581
580
|
});
|
|
582
581
|
}
|
|
583
582
|
}
|
package/package.json
CHANGED
package/src/peer-transfer.ts
CHANGED
|
@@ -562,7 +562,7 @@ export abstract class PeerTransfer {
|
|
|
562
562
|
|
|
563
563
|
async onRequest(conn: DataConnection, message: PeerMessage) {
|
|
564
564
|
console.info('onRequest===>', message.route);
|
|
565
|
-
this.resetIdleTimer();
|
|
565
|
+
// this.resetIdleTimer();
|
|
566
566
|
try {
|
|
567
567
|
await this.router.run(conn, message);
|
|
568
568
|
} catch (err: any) {
|
|
@@ -572,7 +572,7 @@ export abstract class PeerTransfer {
|
|
|
572
572
|
|
|
573
573
|
async onResponse(_conn: DataConnection, message: PeerMessage) {
|
|
574
574
|
console.info('onResponse<====', message.route);
|
|
575
|
-
this.resetIdleTimer();
|
|
575
|
+
// this.resetIdleTimer();
|
|
576
576
|
// 优先检查 health check ping 回调
|
|
577
577
|
const cb = this.requests.get(message.requestId);
|
|
578
578
|
if (cb) {
|