@dxos/network-manager 0.8.1-main.ba2dec9 → 0.8.1-staging.31c3ee1
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/lib/browser/{chunk-WXFQML2V.mjs → chunk-BHB7ZFZF.mjs} +113 -66
- package/dist/lib/browser/chunk-BHB7ZFZF.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-FNZNGA6E.cjs → chunk-D2HGDGMO.cjs} +115 -68
- package/dist/lib/node/chunk-D2HGDGMO.cjs.map +7 -0
- package/dist/lib/node/index.cjs +23 -23
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +14 -14
- package/dist/lib/node-esm/{chunk-6IKF5FQP.mjs → chunk-NHFGO4HB.mjs} +113 -66
- package/dist/lib/node-esm/chunk-NHFGO4HB.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/types/src/swarm/connection.d.ts +4 -1
- package/dist/types/src/swarm/connection.d.ts.map +1 -1
- package/dist/types/src/swarm/peer.d.ts +1 -1
- package/dist/types/src/swarm/peer.d.ts.map +1 -1
- package/dist/types/src/swarm/swarm-mapper.d.ts.map +1 -1
- package/dist/types/src/swarm/swarm.d.ts +1 -0
- package/dist/types/src/swarm/swarm.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/swarm/connection.ts +15 -10
- package/src/swarm/peer.ts +3 -3
- package/src/swarm/swarm-mapper.ts +4 -5
- package/src/swarm/swarm.test.ts +16 -0
- package/src/swarm/swarm.ts +16 -2
- package/dist/lib/browser/chunk-WXFQML2V.mjs.map +0 -7
- package/dist/lib/node/chunk-FNZNGA6E.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-6IKF5FQP.mjs.map +0 -7
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_D2HGDGMO_exports = {};
|
|
30
|
+
__export(chunk_D2HGDGMO_exports, {
|
|
31
31
|
Connection: () => Connection,
|
|
32
32
|
ConnectionLimiter: () => ConnectionLimiter,
|
|
33
33
|
ConnectionLog: () => ConnectionLog,
|
|
@@ -51,7 +51,7 @@ __export(chunk_FNZNGA6E_exports, {
|
|
|
51
51
|
createRtcTransportFactory: () => createRtcTransportFactory,
|
|
52
52
|
createTeleportProtocolFactory: () => createTeleportProtocolFactory
|
|
53
53
|
});
|
|
54
|
-
module.exports = __toCommonJS(
|
|
54
|
+
module.exports = __toCommonJS(chunk_D2HGDGMO_exports);
|
|
55
55
|
var import_async = require("@dxos/async");
|
|
56
56
|
var import_context = require("@dxos/context");
|
|
57
57
|
var import_debug = require("@dxos/debug");
|
|
@@ -275,7 +275,9 @@ var Connection = class {
|
|
|
275
275
|
C: (f, a) => f(...a)
|
|
276
276
|
});
|
|
277
277
|
this._protocolClosed.wake();
|
|
278
|
-
this.close(
|
|
278
|
+
this.close({
|
|
279
|
+
error: new import_protocols.ProtocolError("protocol stream closed")
|
|
280
|
+
}).catch((err) => this.errors.raise(err));
|
|
279
281
|
});
|
|
280
282
|
(0, import_async.scheduleTask)(this.connectedTimeoutContext, async () => {
|
|
281
283
|
import_log.log.info(`timeout waiting ${TRANSPORT_CONNECTION_TIMEOUT / 1e3}s for transport to connect, aborting`, void 0, {
|
|
@@ -370,7 +372,7 @@ var Connection = class {
|
|
|
370
372
|
});
|
|
371
373
|
}
|
|
372
374
|
async abort(err) {
|
|
373
|
-
(0, import_log.log)("
|
|
375
|
+
(0, import_log.log)("abort", {
|
|
374
376
|
err
|
|
375
377
|
}, {
|
|
376
378
|
F: __dxlog_file,
|
|
@@ -393,6 +395,15 @@ var Connection = class {
|
|
|
393
395
|
this.closeReason = err?.message;
|
|
394
396
|
}
|
|
395
397
|
await this._ctx.dispose();
|
|
398
|
+
(0, import_log.log)("aborting...", {
|
|
399
|
+
peerId: this.localInfo,
|
|
400
|
+
err
|
|
401
|
+
}, {
|
|
402
|
+
F: __dxlog_file,
|
|
403
|
+
L: 279,
|
|
404
|
+
S: this,
|
|
405
|
+
C: (f, a) => f(...a)
|
|
406
|
+
});
|
|
396
407
|
try {
|
|
397
408
|
await this._closeProtocol({
|
|
398
409
|
abort: true
|
|
@@ -400,7 +411,7 @@ var Connection = class {
|
|
|
400
411
|
} catch (err2) {
|
|
401
412
|
import_log.log.catch(err2, void 0, {
|
|
402
413
|
F: __dxlog_file,
|
|
403
|
-
L:
|
|
414
|
+
L: 285,
|
|
404
415
|
S: this,
|
|
405
416
|
C: (f, a) => f(...a)
|
|
406
417
|
});
|
|
@@ -410,7 +421,7 @@ var Connection = class {
|
|
|
410
421
|
} catch (err2) {
|
|
411
422
|
import_log.log.catch(err2, void 0, {
|
|
412
423
|
F: __dxlog_file,
|
|
413
|
-
L:
|
|
424
|
+
L: 292,
|
|
414
425
|
S: this,
|
|
415
426
|
C: (f, a) => f(...a)
|
|
416
427
|
});
|
|
@@ -420,62 +431,81 @@ var Connection = class {
|
|
|
420
431
|
} catch (err2) {
|
|
421
432
|
import_log.log.catch(err2, void 0, {
|
|
422
433
|
F: __dxlog_file,
|
|
423
|
-
L:
|
|
434
|
+
L: 298,
|
|
424
435
|
S: this,
|
|
425
436
|
C: (f, a) => f(...a)
|
|
426
437
|
});
|
|
427
438
|
}
|
|
428
439
|
this._changeState("ABORTED");
|
|
429
440
|
}
|
|
430
|
-
async close(
|
|
441
|
+
async close({ error, reason } = {}) {
|
|
442
|
+
(0, import_log.log)("close", {
|
|
443
|
+
error
|
|
444
|
+
}, {
|
|
445
|
+
F: __dxlog_file,
|
|
446
|
+
L: 305,
|
|
447
|
+
S: this,
|
|
448
|
+
C: (f, a) => f(...a)
|
|
449
|
+
});
|
|
431
450
|
if (!this.closeReason) {
|
|
432
|
-
this.closeReason =
|
|
451
|
+
this.closeReason = reason ?? error?.message;
|
|
433
452
|
} else {
|
|
434
|
-
this.closeReason += `; ${
|
|
453
|
+
this.closeReason += `; ${reason ?? error?.message}`;
|
|
435
454
|
}
|
|
436
455
|
if (this._state === "CLOSED" || this._state === "ABORTING" || this._state === "ABORTED") {
|
|
456
|
+
(0, import_log.log)("close ignored: already in progress", {
|
|
457
|
+
state: this._state,
|
|
458
|
+
error
|
|
459
|
+
}, {
|
|
460
|
+
F: __dxlog_file,
|
|
461
|
+
L: 316,
|
|
462
|
+
S: this,
|
|
463
|
+
C: (f, a) => f(...a)
|
|
464
|
+
});
|
|
437
465
|
return;
|
|
438
466
|
}
|
|
439
467
|
const lastState = this._state;
|
|
440
468
|
this._changeState("CLOSING");
|
|
441
469
|
await this.connectedTimeoutContext.dispose();
|
|
442
470
|
await this._ctx.dispose();
|
|
443
|
-
(0, import_log.log)("closing...", {
|
|
444
|
-
peerId: this.localInfo
|
|
445
|
-
}, {
|
|
446
|
-
F: __dxlog_file,
|
|
447
|
-
L: 321,
|
|
448
|
-
S: this,
|
|
449
|
-
C: (f, a) => f(...a)
|
|
450
|
-
});
|
|
451
471
|
let abortProtocol = false;
|
|
452
|
-
if (lastState !== "CONNECTED") {
|
|
472
|
+
if (lastState !== "CONNECTED" || error != null) {
|
|
453
473
|
(0, import_log.log)(`graceful close requested when we were in ${lastState} state? aborting`, void 0, {
|
|
454
474
|
F: __dxlog_file,
|
|
455
|
-
L:
|
|
475
|
+
L: 327,
|
|
456
476
|
S: this,
|
|
457
477
|
C: (f, a) => f(...a)
|
|
458
478
|
});
|
|
459
479
|
abortProtocol = true;
|
|
460
480
|
}
|
|
481
|
+
(0, import_log.log)("closing...", {
|
|
482
|
+
peerId: this.localInfo,
|
|
483
|
+
abortProtocol,
|
|
484
|
+
error
|
|
485
|
+
}, {
|
|
486
|
+
F: __dxlog_file,
|
|
487
|
+
L: 331,
|
|
488
|
+
S: this,
|
|
489
|
+
C: (f, a) => f(...a)
|
|
490
|
+
});
|
|
461
491
|
try {
|
|
462
492
|
await this._closeProtocol({
|
|
463
493
|
abort: abortProtocol
|
|
464
494
|
});
|
|
465
|
-
} catch (
|
|
466
|
-
import_log.log.catch(
|
|
495
|
+
} catch (err) {
|
|
496
|
+
import_log.log.catch(err, void 0, {
|
|
467
497
|
F: __dxlog_file,
|
|
468
|
-
L:
|
|
498
|
+
L: 336,
|
|
469
499
|
S: this,
|
|
470
500
|
C: (f, a) => f(...a)
|
|
471
501
|
});
|
|
472
502
|
}
|
|
473
503
|
try {
|
|
474
504
|
await this._closeTransport();
|
|
475
|
-
} catch (
|
|
476
|
-
import_log.log.catch(
|
|
505
|
+
} catch (err) {
|
|
506
|
+
import_log.log.catch(err, void 0, {
|
|
477
507
|
F: __dxlog_file,
|
|
478
|
-
L:
|
|
508
|
+
L: 342,
|
|
479
509
|
S: this,
|
|
480
510
|
C: (f, a) => f(...a)
|
|
481
511
|
});
|
|
@@ -484,17 +514,17 @@ var Connection = class {
|
|
|
484
514
|
peerId: this.localInfo
|
|
485
515
|
}, {
|
|
486
516
|
F: __dxlog_file,
|
|
487
|
-
L:
|
|
517
|
+
L: 345,
|
|
488
518
|
S: this,
|
|
489
519
|
C: (f, a) => f(...a)
|
|
490
520
|
});
|
|
491
521
|
this._changeState("CLOSED");
|
|
492
|
-
this._callbacks?.onClosed?.(
|
|
522
|
+
this._callbacks?.onClosed?.(error);
|
|
493
523
|
}
|
|
494
524
|
async _closeProtocol(options) {
|
|
495
525
|
(0, import_log.log)("closing protocol", options, {
|
|
496
526
|
F: __dxlog_file,
|
|
497
|
-
L:
|
|
527
|
+
L: 351,
|
|
498
528
|
S: this,
|
|
499
529
|
C: (f, a) => f(...a)
|
|
500
530
|
});
|
|
@@ -504,7 +534,7 @@ var Connection = class {
|
|
|
504
534
|
]);
|
|
505
535
|
(0, import_log.log)("protocol closed", options, {
|
|
506
536
|
F: __dxlog_file,
|
|
507
|
-
L:
|
|
537
|
+
L: 353,
|
|
508
538
|
S: this,
|
|
509
539
|
C: (f, a) => f(...a)
|
|
510
540
|
});
|
|
@@ -512,7 +542,7 @@ var Connection = class {
|
|
|
512
542
|
async _closeTransport() {
|
|
513
543
|
(0, import_log.log)("closing transport", void 0, {
|
|
514
544
|
F: __dxlog_file,
|
|
515
|
-
L:
|
|
545
|
+
L: 357,
|
|
516
546
|
S: this,
|
|
517
547
|
C: (f, a) => f(...a)
|
|
518
548
|
});
|
|
@@ -522,7 +552,7 @@ var Connection = class {
|
|
|
522
552
|
]);
|
|
523
553
|
(0, import_log.log)("transport closed", void 0, {
|
|
524
554
|
F: __dxlog_file,
|
|
525
|
-
L:
|
|
555
|
+
L: 359,
|
|
526
556
|
S: this,
|
|
527
557
|
C: (f, a) => f(...a)
|
|
528
558
|
});
|
|
@@ -563,11 +593,13 @@ var Connection = class {
|
|
|
563
593
|
err
|
|
564
594
|
}, {
|
|
565
595
|
F: __dxlog_file,
|
|
566
|
-
L:
|
|
596
|
+
L: 399,
|
|
567
597
|
S: this,
|
|
568
598
|
C: (f, a) => f(...a)
|
|
569
599
|
});
|
|
570
|
-
await this.close(
|
|
600
|
+
await this.close({
|
|
601
|
+
error: new import_protocols.ConnectivityError("signal message failed to deliver", err)
|
|
602
|
+
});
|
|
571
603
|
}
|
|
572
604
|
}
|
|
573
605
|
/**
|
|
@@ -576,7 +608,7 @@ var Connection = class {
|
|
|
576
608
|
async signal(msg) {
|
|
577
609
|
(0, import_invariant.invariant)(msg.sessionId, void 0, {
|
|
578
610
|
F: __dxlog_file,
|
|
579
|
-
L:
|
|
611
|
+
L: 408,
|
|
580
612
|
S: this,
|
|
581
613
|
A: [
|
|
582
614
|
"msg.sessionId",
|
|
@@ -586,7 +618,7 @@ var Connection = class {
|
|
|
586
618
|
if (!msg.sessionId.equals(this.sessionId)) {
|
|
587
619
|
(0, import_log.log)("dropping signal for incorrect session id", void 0, {
|
|
588
620
|
F: __dxlog_file,
|
|
589
|
-
L:
|
|
621
|
+
L: 410,
|
|
590
622
|
S: this,
|
|
591
623
|
C: (f, a) => f(...a)
|
|
592
624
|
});
|
|
@@ -594,7 +626,7 @@ var Connection = class {
|
|
|
594
626
|
}
|
|
595
627
|
(0, import_invariant.invariant)(msg.data.signal || msg.data.signalBatch, void 0, {
|
|
596
628
|
F: __dxlog_file,
|
|
597
|
-
L:
|
|
629
|
+
L: 413,
|
|
598
630
|
S: this,
|
|
599
631
|
A: [
|
|
600
632
|
"msg.data.signal || msg.data.signalBatch",
|
|
@@ -603,7 +635,7 @@ var Connection = class {
|
|
|
603
635
|
});
|
|
604
636
|
(0, import_invariant.invariant)(msg.author.peerKey === this.remoteInfo.peerKey, void 0, {
|
|
605
637
|
F: __dxlog_file,
|
|
606
|
-
L:
|
|
638
|
+
L: 414,
|
|
607
639
|
S: this,
|
|
608
640
|
A: [
|
|
609
641
|
"msg.author.peerKey === this.remoteInfo.peerKey",
|
|
@@ -612,7 +644,7 @@ var Connection = class {
|
|
|
612
644
|
});
|
|
613
645
|
(0, import_invariant.invariant)(msg.recipient.peerKey === this.localInfo.peerKey, void 0, {
|
|
614
646
|
F: __dxlog_file,
|
|
615
|
-
L:
|
|
647
|
+
L: 415,
|
|
616
648
|
S: this,
|
|
617
649
|
A: [
|
|
618
650
|
"msg.recipient.peerKey === this.localInfo.peerKey",
|
|
@@ -636,7 +668,7 @@ var Connection = class {
|
|
|
636
668
|
msg: msg.data
|
|
637
669
|
}, {
|
|
638
670
|
F: __dxlog_file,
|
|
639
|
-
L:
|
|
671
|
+
L: 424,
|
|
640
672
|
S: this,
|
|
641
673
|
C: (f, a) => f(...a)
|
|
642
674
|
});
|
|
@@ -644,7 +676,7 @@ var Connection = class {
|
|
|
644
676
|
} else {
|
|
645
677
|
(0, import_invariant.invariant)(this._transport, "Connection not ready to accept signals.", {
|
|
646
678
|
F: __dxlog_file,
|
|
647
|
-
L:
|
|
679
|
+
L: 427,
|
|
648
680
|
S: this,
|
|
649
681
|
A: [
|
|
650
682
|
"this._transport",
|
|
@@ -657,7 +689,7 @@ var Connection = class {
|
|
|
657
689
|
msg: msg.data
|
|
658
690
|
}, {
|
|
659
691
|
F: __dxlog_file,
|
|
660
|
-
L:
|
|
692
|
+
L: 428,
|
|
661
693
|
S: this,
|
|
662
694
|
C: (f, a) => f(...a)
|
|
663
695
|
});
|
|
@@ -675,13 +707,13 @@ var Connection = class {
|
|
|
675
707
|
peerId: this.localInfo
|
|
676
708
|
}, {
|
|
677
709
|
F: __dxlog_file,
|
|
678
|
-
L:
|
|
710
|
+
L: 439,
|
|
679
711
|
S: this,
|
|
680
712
|
C: (f, a) => f(...a)
|
|
681
713
|
});
|
|
682
714
|
(0, import_invariant.invariant)(state !== this._state, "Already in this state.", {
|
|
683
715
|
F: __dxlog_file,
|
|
684
|
-
L:
|
|
716
|
+
L: 440,
|
|
685
717
|
S: this,
|
|
686
718
|
A: [
|
|
687
719
|
"state !== this._state",
|
|
@@ -1400,7 +1432,9 @@ var Peer = class {
|
|
|
1400
1432
|
S: this,
|
|
1401
1433
|
C: (f, a) => f(...a)
|
|
1402
1434
|
});
|
|
1403
|
-
await connection.close(
|
|
1435
|
+
await connection.close({
|
|
1436
|
+
error: err
|
|
1437
|
+
});
|
|
1404
1438
|
(0, import_log5.log)("closed", {
|
|
1405
1439
|
peerId: this.remoteInfo,
|
|
1406
1440
|
sessionId: connection.sessionId
|
|
@@ -1436,7 +1470,9 @@ var Peer = class {
|
|
|
1436
1470
|
S: this,
|
|
1437
1471
|
C: (f, a) => f(...a)
|
|
1438
1472
|
});
|
|
1439
|
-
await this?.connection?.close(
|
|
1473
|
+
await this?.connection?.close({
|
|
1474
|
+
reason
|
|
1475
|
+
});
|
|
1440
1476
|
}
|
|
1441
1477
|
};
|
|
1442
1478
|
_ts_decorate2([
|
|
@@ -1730,24 +1766,34 @@ var Swarm = class {
|
|
|
1730
1766
|
accept: false
|
|
1731
1767
|
};
|
|
1732
1768
|
}
|
|
1733
|
-
const peer = this.
|
|
1769
|
+
const peer = this._getOfferSenderPeer(message.author);
|
|
1734
1770
|
const answer = await peer.onOffer(message);
|
|
1735
1771
|
this._topology.update();
|
|
1736
1772
|
return answer;
|
|
1737
1773
|
}
|
|
1774
|
+
_getOfferSenderPeer(senderInfo) {
|
|
1775
|
+
const peer = this._getOrCreatePeer(senderInfo);
|
|
1776
|
+
const connectionState = peer.connection?.state;
|
|
1777
|
+
if (connectionState === ConnectionState.CLOSING || connectionState === ConnectionState.ABORTING) {
|
|
1778
|
+
this._peers.delete(peer.remoteInfo);
|
|
1779
|
+
this.disconnected.emit(peer.remoteInfo);
|
|
1780
|
+
return this._getOrCreatePeer(peer.remoteInfo);
|
|
1781
|
+
}
|
|
1782
|
+
return peer;
|
|
1783
|
+
}
|
|
1738
1784
|
async onSignal(message) {
|
|
1739
1785
|
(0, import_log4.log)("signal", {
|
|
1740
1786
|
message
|
|
1741
1787
|
}, {
|
|
1742
1788
|
F: __dxlog_file5,
|
|
1743
|
-
L:
|
|
1789
|
+
L: 246,
|
|
1744
1790
|
S: this,
|
|
1745
1791
|
C: (f, a) => f(...a)
|
|
1746
1792
|
});
|
|
1747
1793
|
if (this._ctx.disposed) {
|
|
1748
1794
|
import_log4.log.info("ignored for offline swarm", void 0, {
|
|
1749
1795
|
F: __dxlog_file5,
|
|
1750
|
-
L:
|
|
1796
|
+
L: 248,
|
|
1751
1797
|
S: this,
|
|
1752
1798
|
C: (f, a) => f(...a)
|
|
1753
1799
|
});
|
|
@@ -1755,7 +1801,7 @@ var Swarm = class {
|
|
|
1755
1801
|
}
|
|
1756
1802
|
(0, import_invariant3.invariant)(message.recipient.peerKey === this._ownPeer.peerKey, `Invalid signal peer id expected=${this.ownPeerId}, actual=${message.recipient}`, {
|
|
1757
1803
|
F: __dxlog_file5,
|
|
1758
|
-
L:
|
|
1804
|
+
L: 251,
|
|
1759
1805
|
S: this,
|
|
1760
1806
|
A: [
|
|
1761
1807
|
"message.recipient.peerKey === this._ownPeer.peerKey",
|
|
@@ -1764,7 +1810,7 @@ var Swarm = class {
|
|
|
1764
1810
|
});
|
|
1765
1811
|
(0, import_invariant3.invariant)(message.topic?.equals(this._topic), void 0, {
|
|
1766
1812
|
F: __dxlog_file5,
|
|
1767
|
-
L:
|
|
1813
|
+
L: 255,
|
|
1768
1814
|
S: this,
|
|
1769
1815
|
A: [
|
|
1770
1816
|
"message.topic?.equals(this._topic)",
|
|
@@ -1773,7 +1819,7 @@ var Swarm = class {
|
|
|
1773
1819
|
});
|
|
1774
1820
|
(0, import_invariant3.invariant)(message.author, void 0, {
|
|
1775
1821
|
F: __dxlog_file5,
|
|
1776
|
-
L:
|
|
1822
|
+
L: 256,
|
|
1777
1823
|
S: this,
|
|
1778
1824
|
A: [
|
|
1779
1825
|
"message.author",
|
|
@@ -1794,13 +1840,13 @@ var Swarm = class {
|
|
|
1794
1840
|
async goOnline() {
|
|
1795
1841
|
this._ctx = new import_context3.Context(void 0, {
|
|
1796
1842
|
F: __dxlog_file5,
|
|
1797
|
-
L:
|
|
1843
|
+
L: 272
|
|
1798
1844
|
});
|
|
1799
1845
|
}
|
|
1800
1846
|
_getOrCreatePeer(peerInfo) {
|
|
1801
1847
|
(0, import_invariant3.invariant)(peerInfo.peerKey, "PeerInfo.peerKey is required", {
|
|
1802
1848
|
F: __dxlog_file5,
|
|
1803
|
-
L:
|
|
1849
|
+
L: 276,
|
|
1804
1850
|
S: this,
|
|
1805
1851
|
A: [
|
|
1806
1852
|
"peerInfo.peerKey",
|
|
@@ -1820,7 +1866,7 @@ var Swarm = class {
|
|
|
1820
1866
|
if (this._isUnregistered(peer)) {
|
|
1821
1867
|
import_log4.log.verbose("ignored onDisconnected for unregistered peer", void 0, {
|
|
1822
1868
|
F: __dxlog_file5,
|
|
1823
|
-
L:
|
|
1869
|
+
L: 296,
|
|
1824
1870
|
S: this,
|
|
1825
1871
|
C: (f, a) => f(...a)
|
|
1826
1872
|
});
|
|
@@ -1838,7 +1884,7 @@ var Swarm = class {
|
|
|
1838
1884
|
peerInfo
|
|
1839
1885
|
}, {
|
|
1840
1886
|
F: __dxlog_file5,
|
|
1841
|
-
L:
|
|
1887
|
+
L: 310,
|
|
1842
1888
|
S: this,
|
|
1843
1889
|
C: (f, a) => f(...a)
|
|
1844
1890
|
});
|
|
@@ -1865,14 +1911,14 @@ var Swarm = class {
|
|
|
1865
1911
|
reason
|
|
1866
1912
|
}, {
|
|
1867
1913
|
F: __dxlog_file5,
|
|
1868
|
-
L:
|
|
1914
|
+
L: 332,
|
|
1869
1915
|
S: this,
|
|
1870
1916
|
C: (f, a) => f(...a)
|
|
1871
1917
|
});
|
|
1872
1918
|
const peer = this._peers.get(peerInfo);
|
|
1873
1919
|
(0, import_invariant3.invariant)(peer, void 0, {
|
|
1874
1920
|
F: __dxlog_file5,
|
|
1875
|
-
L:
|
|
1921
|
+
L: 334,
|
|
1876
1922
|
S: this,
|
|
1877
1923
|
A: [
|
|
1878
1924
|
"peer",
|
|
@@ -1880,7 +1926,7 @@ var Swarm = class {
|
|
|
1880
1926
|
]
|
|
1881
1927
|
});
|
|
1882
1928
|
this._peers.delete(peerInfo);
|
|
1883
|
-
await peer.safeDestroy(
|
|
1929
|
+
await peer.safeDestroy(reason);
|
|
1884
1930
|
}
|
|
1885
1931
|
_getSwarmController() {
|
|
1886
1932
|
return {
|
|
@@ -1902,7 +1948,7 @@ var Swarm = class {
|
|
|
1902
1948
|
} catch (err) {
|
|
1903
1949
|
(0, import_log4.log)("initiation error", err, {
|
|
1904
1950
|
F: __dxlog_file5,
|
|
1905
|
-
L:
|
|
1951
|
+
L: 361,
|
|
1906
1952
|
S: this,
|
|
1907
1953
|
C: (f, a) => f(...a)
|
|
1908
1954
|
});
|
|
@@ -1933,7 +1979,7 @@ var Swarm = class {
|
|
|
1933
1979
|
remotePeer
|
|
1934
1980
|
}, {
|
|
1935
1981
|
F: __dxlog_file5,
|
|
1936
|
-
L:
|
|
1982
|
+
L: 389,
|
|
1937
1983
|
S: this,
|
|
1938
1984
|
C: (f, a) => f(...a)
|
|
1939
1985
|
});
|
|
@@ -1952,7 +1998,7 @@ var Swarm = class {
|
|
|
1952
1998
|
remotePeer
|
|
1953
1999
|
}, {
|
|
1954
2000
|
F: __dxlog_file5,
|
|
1955
|
-
L:
|
|
2001
|
+
L: 405,
|
|
1956
2002
|
S: this,
|
|
1957
2003
|
C: (f, a) => f(...a)
|
|
1958
2004
|
});
|
|
@@ -1962,7 +2008,7 @@ var Swarm = class {
|
|
|
1962
2008
|
remotePeer
|
|
1963
2009
|
}, {
|
|
1964
2010
|
F: __dxlog_file5,
|
|
1965
|
-
L:
|
|
2011
|
+
L: 408,
|
|
1966
2012
|
S: this,
|
|
1967
2013
|
C: (f, a) => f(...a)
|
|
1968
2014
|
});
|
|
@@ -2016,7 +2062,7 @@ var SwarmMapper = class {
|
|
|
2016
2062
|
}
|
|
2017
2063
|
constructor(_swarm) {
|
|
2018
2064
|
this._swarm = _swarm;
|
|
2019
|
-
this._subscriptions = new import_async5.
|
|
2065
|
+
this._subscriptions = new import_async5.SubscriptionList();
|
|
2020
2066
|
this._connectionSubscriptions = new import_util4.ComplexMap(import_messaging2.PeerInfoHash);
|
|
2021
2067
|
this._peers = new import_util4.ComplexMap(import_messaging2.PeerInfoHash);
|
|
2022
2068
|
this.mapUpdated = new import_async5.Event();
|
|
@@ -2036,7 +2082,7 @@ var SwarmMapper = class {
|
|
|
2036
2082
|
_update() {
|
|
2037
2083
|
(0, import_log6.log)("updating swarm", void 0, {
|
|
2038
2084
|
F: __dxlog_file6,
|
|
2039
|
-
L:
|
|
2085
|
+
L: 71,
|
|
2040
2086
|
S: this,
|
|
2041
2087
|
C: (f, a) => f(...a)
|
|
2042
2088
|
});
|
|
@@ -2060,7 +2106,7 @@ var SwarmMapper = class {
|
|
|
2060
2106
|
totalPeersInSwarm: this._peers.size
|
|
2061
2107
|
}, {
|
|
2062
2108
|
F: __dxlog_file6,
|
|
2063
|
-
L:
|
|
2109
|
+
L: 112,
|
|
2064
2110
|
S: this,
|
|
2065
2111
|
C: (f, a) => f(...a)
|
|
2066
2112
|
});
|
|
@@ -2069,6 +2115,7 @@ var SwarmMapper = class {
|
|
|
2069
2115
|
// TODO(burdon): Async open/close.
|
|
2070
2116
|
destroy() {
|
|
2071
2117
|
Array.from(this._connectionSubscriptions.values()).forEach((cb) => cb());
|
|
2118
|
+
this._connectionSubscriptions.clear();
|
|
2072
2119
|
this._subscriptions.clear();
|
|
2073
2120
|
}
|
|
2074
2121
|
};
|
|
@@ -4422,4 +4469,4 @@ var createTeleportProtocolFactory = (onConnection, defaultParams) => {
|
|
|
4422
4469
|
createRtcTransportFactory,
|
|
4423
4470
|
createTeleportProtocolFactory
|
|
4424
4471
|
});
|
|
4425
|
-
//# sourceMappingURL=chunk-
|
|
4472
|
+
//# sourceMappingURL=chunk-D2HGDGMO.cjs.map
|