egos-transfer 0.2.8 → 0.2.9
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 +6 -7
- package/package.json +1 -1
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,6 +466,7 @@ class PeerTransfer {
|
|
|
466
466
|
// ── Router integration ──────────────────────────────────────────
|
|
467
467
|
onRequest(conn, message) {
|
|
468
468
|
return __awaiter(this, void 0, void 0, function* () {
|
|
469
|
+
console.info('onRequest===>', message.route);
|
|
469
470
|
this.resetIdleTimer();
|
|
470
471
|
try {
|
|
471
472
|
yield this.router.run(conn, message);
|
|
@@ -477,6 +478,7 @@ class PeerTransfer {
|
|
|
477
478
|
}
|
|
478
479
|
onResponse(_conn, message) {
|
|
479
480
|
return __awaiter(this, void 0, void 0, function* () {
|
|
481
|
+
console.info('onResponse<====', message.route);
|
|
480
482
|
this.resetIdleTimer();
|
|
481
483
|
// 优先检查 health check ping 回调
|
|
482
484
|
const cb = this.requests.get(message.requestId);
|
|
@@ -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
|
}
|