@dxos/network-manager 0.3.3-main.f990aad → 0.3.3-next.6bede4d
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-DBVOJAYS.mjs → chunk-W7BW2FK6.mjs} +60 -49
- package/dist/lib/browser/chunk-W7BW2FK6.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/index.cjs +56 -45
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +56 -45
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/signal/swarm-messenger.d.ts.map +1 -1
- package/dist/types/src/swarm/swarm.d.ts.map +1 -1
- package/dist/types/src/tests/basic-test-suite.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/signal/swarm-messenger.ts +6 -2
- package/src/swarm/connection.ts +4 -4
- package/src/swarm/peer.ts +2 -2
- package/src/swarm/swarm.ts +2 -1
- package/src/tests/basic-test-suite.ts +0 -2
- package/src/transport/libdatachannel-transport.ts +1 -1
- package/src/transport/simplepeer-transport.ts +1 -1
- package/dist/lib/browser/chunk-DBVOJAYS.mjs.map +0 -7
|
@@ -159,7 +159,7 @@ var Connection = class {
|
|
|
159
159
|
this.close(new ProtocolError("protocol stream closed")).catch((err) => this.errors.raise(err));
|
|
160
160
|
});
|
|
161
161
|
scheduleTask(this.connectedTimeoutContext, async () => {
|
|
162
|
-
log.
|
|
162
|
+
log.info("timeout waiting for transport to connect, aborting", void 0, {
|
|
163
163
|
F: __dxlog_file,
|
|
164
164
|
L: 180,
|
|
165
165
|
S: this,
|
|
@@ -209,7 +209,7 @@ var Connection = class {
|
|
|
209
209
|
this.closeReason = err?.message;
|
|
210
210
|
}
|
|
211
211
|
if (err instanceof ConnectionResetError) {
|
|
212
|
-
log.
|
|
212
|
+
log.info("aborting due to transport ConnectionResetError", void 0, {
|
|
213
213
|
F: __dxlog_file,
|
|
214
214
|
L: 213,
|
|
215
215
|
S: this,
|
|
@@ -217,7 +217,7 @@ var Connection = class {
|
|
|
217
217
|
});
|
|
218
218
|
this.abort().catch((err2) => this.errors.raise(err2));
|
|
219
219
|
} else if (err instanceof ConnectivityError) {
|
|
220
|
-
log.
|
|
220
|
+
log.info("aborting due to transport ConnectivityError", void 0, {
|
|
221
221
|
F: __dxlog_file,
|
|
222
222
|
L: 216,
|
|
223
223
|
S: this,
|
|
@@ -400,7 +400,7 @@ var Connection = class {
|
|
|
400
400
|
if (err instanceof CancelledError || err instanceof Error && err.message?.includes("CANCELLED")) {
|
|
401
401
|
return;
|
|
402
402
|
}
|
|
403
|
-
log.
|
|
403
|
+
log.info("signal message failed to deliver", {
|
|
404
404
|
err
|
|
405
405
|
}, {
|
|
406
406
|
F: __dxlog_file,
|
|
@@ -545,7 +545,7 @@ import { Context as Context2 } from "@dxos/context";
|
|
|
545
545
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
546
546
|
import { PublicKey as PublicKey2 } from "@dxos/keys";
|
|
547
547
|
import { log as log2 } from "@dxos/log";
|
|
548
|
-
import { schema } from "@dxos/protocols";
|
|
548
|
+
import { schema, TimeoutError } from "@dxos/protocols";
|
|
549
549
|
import { ComplexMap } from "@dxos/util";
|
|
550
550
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/signal/swarm-messenger.ts";
|
|
551
551
|
var SwarmMessage = schema.getCodecForType("dxos.mesh.swarm.SwarmMessage");
|
|
@@ -730,20 +730,31 @@ var SwarmMessenger = class {
|
|
|
730
730
|
}
|
|
731
731
|
});
|
|
732
732
|
} catch (err) {
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
733
|
+
if (err instanceof TimeoutError) {
|
|
734
|
+
log2.info("timeout sending answer to offer", {
|
|
735
|
+
err
|
|
736
|
+
}, {
|
|
737
|
+
F: __dxlog_file2,
|
|
738
|
+
L: 175,
|
|
739
|
+
S: this,
|
|
740
|
+
C: (f, a) => f(...a)
|
|
741
|
+
});
|
|
742
|
+
} else {
|
|
743
|
+
log2.info("error sending answer to offer", {
|
|
744
|
+
err
|
|
745
|
+
}, {
|
|
746
|
+
F: __dxlog_file2,
|
|
747
|
+
L: 177,
|
|
748
|
+
S: this,
|
|
749
|
+
C: (f, a) => f(...a)
|
|
750
|
+
});
|
|
751
|
+
}
|
|
741
752
|
}
|
|
742
753
|
}
|
|
743
754
|
async _handleSignal({ author, recipient, message }) {
|
|
744
755
|
invariant2(message.messageId, void 0, {
|
|
745
756
|
F: __dxlog_file2,
|
|
746
|
-
L:
|
|
757
|
+
L: 191,
|
|
747
758
|
S: this,
|
|
748
759
|
A: [
|
|
749
760
|
"message.messageId",
|
|
@@ -752,7 +763,7 @@ var SwarmMessenger = class {
|
|
|
752
763
|
});
|
|
753
764
|
invariant2(message.data.signal || message.data.signalBatch, "Invalid message", {
|
|
754
765
|
F: __dxlog_file2,
|
|
755
|
-
L:
|
|
766
|
+
L: 192,
|
|
756
767
|
S: this,
|
|
757
768
|
A: [
|
|
758
769
|
"message.data.signal || message.data.signalBatch",
|
|
@@ -884,7 +895,7 @@ var Peer = class {
|
|
|
884
895
|
await connection.openConnection();
|
|
885
896
|
} catch (err) {
|
|
886
897
|
if (!(err instanceof CancelledError2)) {
|
|
887
|
-
log3.
|
|
898
|
+
log3.info("connection error", {
|
|
888
899
|
topic: this.topic,
|
|
889
900
|
peerId: this.localPeerId,
|
|
890
901
|
remoteId: this.id,
|
|
@@ -1167,7 +1178,7 @@ var Peer = class {
|
|
|
1167
1178
|
void this._connectionCtx?.dispose();
|
|
1168
1179
|
this._connectionCtx = this._ctx.derive();
|
|
1169
1180
|
connection.errors.handle((err) => {
|
|
1170
|
-
log3.
|
|
1181
|
+
log3.info("connection error, closing", {
|
|
1171
1182
|
topic: this.topic,
|
|
1172
1183
|
peerId: this.localPeerId,
|
|
1173
1184
|
remoteId: this.id,
|
|
@@ -1366,11 +1377,11 @@ var Swarm = class {
|
|
|
1366
1377
|
peerId: this._ownPeerId,
|
|
1367
1378
|
payloadType: "dxos.mesh.swarm.SwarmMessage",
|
|
1368
1379
|
onMessage: async (message) => {
|
|
1369
|
-
await this._swarmMessenger.receiveMessage(message).catch((err) => log4.
|
|
1380
|
+
await this._swarmMessenger.receiveMessage(message).catch((err) => log4.info("Error while receiving message", {
|
|
1370
1381
|
err
|
|
1371
1382
|
}, {
|
|
1372
1383
|
F: __dxlog_file4,
|
|
1373
|
-
L:
|
|
1384
|
+
L: 136,
|
|
1374
1385
|
S: this,
|
|
1375
1386
|
C: (f, a) => f(...a)
|
|
1376
1387
|
}));
|
|
@@ -1380,7 +1391,7 @@ var Swarm = class {
|
|
|
1380
1391
|
async destroy() {
|
|
1381
1392
|
log4("destroying...", void 0, {
|
|
1382
1393
|
F: __dxlog_file4,
|
|
1383
|
-
L:
|
|
1394
|
+
L: 142,
|
|
1384
1395
|
S: this,
|
|
1385
1396
|
C: (f, a) => f(...a)
|
|
1386
1397
|
});
|
|
@@ -1391,7 +1402,7 @@ var Swarm = class {
|
|
|
1391
1402
|
await Promise.all(Array.from(this._peers.keys()).map((key) => this._destroyPeer(key, "swarm destroyed")));
|
|
1392
1403
|
log4("destroyed", void 0, {
|
|
1393
1404
|
F: __dxlog_file4,
|
|
1394
|
-
L:
|
|
1405
|
+
L: 149,
|
|
1395
1406
|
S: this,
|
|
1396
1407
|
C: (f, a) => f(...a)
|
|
1397
1408
|
});
|
|
@@ -1399,7 +1410,7 @@ var Swarm = class {
|
|
|
1399
1410
|
async setTopology(topology) {
|
|
1400
1411
|
invariant4(!this._ctx.disposed, "Swarm is offline", {
|
|
1401
1412
|
F: __dxlog_file4,
|
|
1402
|
-
L:
|
|
1413
|
+
L: 153,
|
|
1403
1414
|
S: this,
|
|
1404
1415
|
A: [
|
|
1405
1416
|
"!this._ctx.disposed",
|
|
@@ -1414,7 +1425,7 @@ var Swarm = class {
|
|
|
1414
1425
|
topology: getClassName(topology)
|
|
1415
1426
|
}, {
|
|
1416
1427
|
F: __dxlog_file4,
|
|
1417
|
-
L:
|
|
1428
|
+
L: 157,
|
|
1418
1429
|
S: this,
|
|
1419
1430
|
C: (f, a) => f(...a)
|
|
1420
1431
|
});
|
|
@@ -1428,14 +1439,14 @@ var Swarm = class {
|
|
|
1428
1439
|
swarmEvent
|
|
1429
1440
|
}, {
|
|
1430
1441
|
F: __dxlog_file4,
|
|
1431
|
-
L:
|
|
1442
|
+
L: 170,
|
|
1432
1443
|
S: this,
|
|
1433
1444
|
C: (f, a) => f(...a)
|
|
1434
1445
|
});
|
|
1435
1446
|
if (this._ctx.disposed) {
|
|
1436
1447
|
log4("swarm event ignored for disposed swarm", void 0, {
|
|
1437
1448
|
F: __dxlog_file4,
|
|
1438
|
-
L:
|
|
1449
|
+
L: 173,
|
|
1439
1450
|
S: this,
|
|
1440
1451
|
C: (f, a) => f(...a)
|
|
1441
1452
|
});
|
|
@@ -1447,7 +1458,7 @@ var Swarm = class {
|
|
|
1447
1458
|
peerId
|
|
1448
1459
|
}, {
|
|
1449
1460
|
F: __dxlog_file4,
|
|
1450
|
-
L:
|
|
1461
|
+
L: 179,
|
|
1451
1462
|
S: this,
|
|
1452
1463
|
C: (f, a) => f(...a)
|
|
1453
1464
|
});
|
|
@@ -1462,7 +1473,7 @@ var Swarm = class {
|
|
|
1462
1473
|
if (peer.connection?.state !== ConnectionState.CONNECTED) {
|
|
1463
1474
|
void this._destroyPeer(peer.id, "peer left").catch((err) => log4.catch(err, void 0, {
|
|
1464
1475
|
F: __dxlog_file4,
|
|
1465
|
-
L:
|
|
1476
|
+
L: 190,
|
|
1466
1477
|
S: this,
|
|
1467
1478
|
C: (f, a) => f(...a)
|
|
1468
1479
|
}));
|
|
@@ -1472,7 +1483,7 @@ var Swarm = class {
|
|
|
1472
1483
|
peer: swarmEvent.peerLeft.peer
|
|
1473
1484
|
}, {
|
|
1474
1485
|
F: __dxlog_file4,
|
|
1475
|
-
L:
|
|
1486
|
+
L: 193,
|
|
1476
1487
|
S: this,
|
|
1477
1488
|
C: (f, a) => f(...a)
|
|
1478
1489
|
});
|
|
@@ -1485,14 +1496,14 @@ var Swarm = class {
|
|
|
1485
1496
|
message
|
|
1486
1497
|
}, {
|
|
1487
1498
|
F: __dxlog_file4,
|
|
1488
|
-
L:
|
|
1499
|
+
L: 202,
|
|
1489
1500
|
S: this,
|
|
1490
1501
|
C: (f, a) => f(...a)
|
|
1491
1502
|
});
|
|
1492
1503
|
if (this._ctx.disposed) {
|
|
1493
1504
|
log4("ignored for disposed swarm", void 0, {
|
|
1494
1505
|
F: __dxlog_file4,
|
|
1495
|
-
L:
|
|
1506
|
+
L: 204,
|
|
1496
1507
|
S: this,
|
|
1497
1508
|
C: (f, a) => f(...a)
|
|
1498
1509
|
});
|
|
@@ -1502,7 +1513,7 @@ var Swarm = class {
|
|
|
1502
1513
|
}
|
|
1503
1514
|
invariant4(message.author, void 0, {
|
|
1504
1515
|
F: __dxlog_file4,
|
|
1505
|
-
L:
|
|
1516
|
+
L: 209,
|
|
1506
1517
|
S: this,
|
|
1507
1518
|
A: [
|
|
1508
1519
|
"message.author",
|
|
@@ -1514,7 +1525,7 @@ var Swarm = class {
|
|
|
1514
1525
|
message
|
|
1515
1526
|
}, {
|
|
1516
1527
|
F: __dxlog_file4,
|
|
1517
|
-
L:
|
|
1528
|
+
L: 211,
|
|
1518
1529
|
S: this,
|
|
1519
1530
|
C: (f, a) => f(...a)
|
|
1520
1531
|
});
|
|
@@ -1527,7 +1538,7 @@ var Swarm = class {
|
|
|
1527
1538
|
message
|
|
1528
1539
|
}, {
|
|
1529
1540
|
F: __dxlog_file4,
|
|
1530
|
-
L:
|
|
1541
|
+
L: 215,
|
|
1531
1542
|
S: this,
|
|
1532
1543
|
C: (f, a) => f(...a)
|
|
1533
1544
|
});
|
|
@@ -1545,14 +1556,14 @@ var Swarm = class {
|
|
|
1545
1556
|
message
|
|
1546
1557
|
}, {
|
|
1547
1558
|
F: __dxlog_file4,
|
|
1548
|
-
L:
|
|
1559
|
+
L: 226,
|
|
1549
1560
|
S: this,
|
|
1550
1561
|
C: (f, a) => f(...a)
|
|
1551
1562
|
});
|
|
1552
1563
|
if (this._ctx.disposed) {
|
|
1553
1564
|
log4.info("ignored for offline swarm", void 0, {
|
|
1554
1565
|
F: __dxlog_file4,
|
|
1555
|
-
L:
|
|
1566
|
+
L: 228,
|
|
1556
1567
|
S: this,
|
|
1557
1568
|
C: (f, a) => f(...a)
|
|
1558
1569
|
});
|
|
@@ -1560,7 +1571,7 @@ var Swarm = class {
|
|
|
1560
1571
|
}
|
|
1561
1572
|
invariant4(message.recipient?.equals(this._ownPeerId), `Invalid signal peer id expected=${this.ownPeerId}, actual=${message.recipient}`, {
|
|
1562
1573
|
F: __dxlog_file4,
|
|
1563
|
-
L:
|
|
1574
|
+
L: 231,
|
|
1564
1575
|
S: this,
|
|
1565
1576
|
A: [
|
|
1566
1577
|
"message.recipient?.equals(this._ownPeerId)",
|
|
@@ -1569,7 +1580,7 @@ var Swarm = class {
|
|
|
1569
1580
|
});
|
|
1570
1581
|
invariant4(message.topic?.equals(this._topic), void 0, {
|
|
1571
1582
|
F: __dxlog_file4,
|
|
1572
|
-
L:
|
|
1583
|
+
L: 235,
|
|
1573
1584
|
S: this,
|
|
1574
1585
|
A: [
|
|
1575
1586
|
"message.topic?.equals(this._topic)",
|
|
@@ -1578,7 +1589,7 @@ var Swarm = class {
|
|
|
1578
1589
|
});
|
|
1579
1590
|
invariant4(message.author, void 0, {
|
|
1580
1591
|
F: __dxlog_file4,
|
|
1581
|
-
L:
|
|
1592
|
+
L: 236,
|
|
1582
1593
|
S: this,
|
|
1583
1594
|
A: [
|
|
1584
1595
|
"message.author",
|
|
@@ -1622,7 +1633,7 @@ var Swarm = class {
|
|
|
1622
1633
|
peerId
|
|
1623
1634
|
}, {
|
|
1624
1635
|
F: __dxlog_file4,
|
|
1625
|
-
L:
|
|
1636
|
+
L: 285,
|
|
1626
1637
|
S: this,
|
|
1627
1638
|
C: (f, a) => f(...a)
|
|
1628
1639
|
});
|
|
@@ -1646,7 +1657,7 @@ var Swarm = class {
|
|
|
1646
1657
|
async _destroyPeer(peerId, reason) {
|
|
1647
1658
|
invariant4(this._peers.has(peerId), void 0, {
|
|
1648
1659
|
F: __dxlog_file4,
|
|
1649
|
-
L:
|
|
1660
|
+
L: 307,
|
|
1650
1661
|
S: this,
|
|
1651
1662
|
A: [
|
|
1652
1663
|
"this._peers.has(peerId)",
|
|
@@ -1673,7 +1684,7 @@ var Swarm = class {
|
|
|
1673
1684
|
} catch (err) {
|
|
1674
1685
|
log4("initiation error", err, {
|
|
1675
1686
|
F: __dxlog_file4,
|
|
1676
|
-
L:
|
|
1687
|
+
L: 333,
|
|
1677
1688
|
S: this,
|
|
1678
1689
|
C: (f, a) => f(...a)
|
|
1679
1690
|
});
|
|
@@ -1701,7 +1712,7 @@ var Swarm = class {
|
|
|
1701
1712
|
remoteId
|
|
1702
1713
|
}, {
|
|
1703
1714
|
F: __dxlog_file4,
|
|
1704
|
-
L:
|
|
1715
|
+
L: 360,
|
|
1705
1716
|
S: this,
|
|
1706
1717
|
C: (f, a) => f(...a)
|
|
1707
1718
|
});
|
|
@@ -1718,7 +1729,7 @@ var Swarm = class {
|
|
|
1718
1729
|
remoteId
|
|
1719
1730
|
}, {
|
|
1720
1731
|
F: __dxlog_file4,
|
|
1721
|
-
L:
|
|
1732
|
+
L: 374,
|
|
1722
1733
|
S: this,
|
|
1723
1734
|
C: (f, a) => f(...a)
|
|
1724
1735
|
});
|
|
@@ -1728,7 +1739,7 @@ var Swarm = class {
|
|
|
1728
1739
|
remoteId
|
|
1729
1740
|
}, {
|
|
1730
1741
|
F: __dxlog_file4,
|
|
1731
|
-
L:
|
|
1742
|
+
L: 377,
|
|
1732
1743
|
S: this,
|
|
1733
1744
|
C: (f, a) => f(...a)
|
|
1734
1745
|
});
|
|
@@ -2799,7 +2810,7 @@ var SimplePeerTransport = class {
|
|
|
2799
2810
|
try {
|
|
2800
2811
|
if (typeof this._peer?._pc?.getStats === "function") {
|
|
2801
2812
|
this._peer._pc.getStats().then((stats) => {
|
|
2802
|
-
log11.
|
|
2813
|
+
log11.info("report after webrtc error", {
|
|
2803
2814
|
config: this.params.webrtcConfig,
|
|
2804
2815
|
stats
|
|
2805
2816
|
}, {
|
|
@@ -3018,7 +3029,7 @@ import { ErrorStream as ErrorStream5 } from "@dxos/debug";
|
|
|
3018
3029
|
import { invariant as invariant13 } from "@dxos/invariant";
|
|
3019
3030
|
import { PublicKey as PublicKey12 } from "@dxos/keys";
|
|
3020
3031
|
import { log as log13 } from "@dxos/log";
|
|
3021
|
-
import { ConnectionResetError as ConnectionResetError3, TimeoutError, ProtocolError as ProtocolError3, ConnectivityError as ConnectivityError3, UnknownProtocolError as UnknownProtocolError3 } from "@dxos/protocols";
|
|
3032
|
+
import { ConnectionResetError as ConnectionResetError3, TimeoutError as TimeoutError2, ProtocolError as ProtocolError3, ConnectivityError as ConnectivityError3, UnknownProtocolError as UnknownProtocolError3 } from "@dxos/protocols";
|
|
3022
3033
|
import { ConnectionState as ConnectionState4 } from "@dxos/protocols/proto/dxos/mesh/bridge";
|
|
3023
3034
|
import { arrayToBuffer } from "@dxos/util";
|
|
3024
3035
|
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport-proxy.ts";
|
|
@@ -3171,7 +3182,7 @@ var decodeError = (err) => {
|
|
|
3171
3182
|
if (message.includes("CONNECTION_RESET")) {
|
|
3172
3183
|
return new ConnectionResetError3(message);
|
|
3173
3184
|
} else if (message.includes("TIMEOUT")) {
|
|
3174
|
-
return new
|
|
3185
|
+
return new TimeoutError2(message);
|
|
3175
3186
|
} else if (message.includes("PROTOCOL_ERROR")) {
|
|
3176
3187
|
return new ProtocolError3(message);
|
|
3177
3188
|
} else if (message.includes("CONNECTIVITY_ERROR")) {
|
|
@@ -3265,7 +3276,7 @@ var LibDataChannelTransport = class {
|
|
|
3265
3276
|
}
|
|
3266
3277
|
});
|
|
3267
3278
|
} catch (err) {
|
|
3268
|
-
log14.
|
|
3279
|
+
log14.info("signaling errror", {
|
|
3269
3280
|
err
|
|
3270
3281
|
}, {
|
|
3271
3282
|
F: __dxlog_file15,
|
|
@@ -3591,4 +3602,4 @@ export {
|
|
|
3591
3602
|
TcpTransport,
|
|
3592
3603
|
createTeleportProtocolFactory
|
|
3593
3604
|
};
|
|
3594
|
-
//# sourceMappingURL=chunk-
|
|
3605
|
+
//# sourceMappingURL=chunk-W7BW2FK6.mjs.map
|