@dxos/network-manager 0.4.10-main.fa5a270 → 0.4.10-main.fd4f2a3

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.
@@ -1343,7 +1343,7 @@ var Swarm = class {
1343
1343
  }
1344
1344
  }), {
1345
1345
  F: __dxlog_file4,
1346
- L: 88,
1346
+ L: 89,
1347
1347
  S: this,
1348
1348
  C: (f, a) => f(...a)
1349
1349
  });
@@ -1351,7 +1351,7 @@ var Swarm = class {
1351
1351
  peerId: _ownPeerId
1352
1352
  }, {
1353
1353
  F: __dxlog_file4,
1354
- L: 92,
1354
+ L: 93,
1355
1355
  S: this,
1356
1356
  C: (f, a) => f(...a)
1357
1357
  });
@@ -1366,7 +1366,7 @@ var Swarm = class {
1366
1366
  id: this._instanceId
1367
1367
  }), {
1368
1368
  F: __dxlog_file4,
1369
- L: 101,
1369
+ L: 102,
1370
1370
  S: this,
1371
1371
  C: (f, a) => f(...a)
1372
1372
  });
@@ -1389,7 +1389,7 @@ var Swarm = class {
1389
1389
  async open() {
1390
1390
  invariant4(!this._listeningHandle, void 0, {
1391
1391
  F: __dxlog_file4,
1392
- L: 128,
1392
+ L: 129,
1393
1393
  S: this,
1394
1394
  A: [
1395
1395
  "!this._listeningHandle",
@@ -1404,7 +1404,7 @@ var Swarm = class {
1404
1404
  err
1405
1405
  }, {
1406
1406
  F: __dxlog_file4,
1407
- L: 136,
1407
+ L: 137,
1408
1408
  S: this,
1409
1409
  C: (f, a) => f(...a)
1410
1410
  }));
@@ -1414,7 +1414,7 @@ var Swarm = class {
1414
1414
  async destroy() {
1415
1415
  log4("destroying...", void 0, {
1416
1416
  F: __dxlog_file4,
1417
- L: 142,
1417
+ L: 143,
1418
1418
  S: this,
1419
1419
  C: (f, a) => f(...a)
1420
1420
  });
@@ -1425,7 +1425,7 @@ var Swarm = class {
1425
1425
  await Promise.all(Array.from(this._peers.keys()).map((key) => this._destroyPeer(key, "swarm destroyed")));
1426
1426
  log4("destroyed", void 0, {
1427
1427
  F: __dxlog_file4,
1428
- L: 149,
1428
+ L: 150,
1429
1429
  S: this,
1430
1430
  C: (f, a) => f(...a)
1431
1431
  });
@@ -1433,7 +1433,7 @@ var Swarm = class {
1433
1433
  async setTopology(topology) {
1434
1434
  invariant4(!this._ctx.disposed, "Swarm is offline", {
1435
1435
  F: __dxlog_file4,
1436
- L: 153,
1436
+ L: 154,
1437
1437
  S: this,
1438
1438
  A: [
1439
1439
  "!this._ctx.disposed",
@@ -1448,7 +1448,7 @@ var Swarm = class {
1448
1448
  topology: getClassName(topology)
1449
1449
  }, {
1450
1450
  F: __dxlog_file4,
1451
- L: 157,
1451
+ L: 158,
1452
1452
  S: this,
1453
1453
  C: (f, a) => f(...a)
1454
1454
  });
@@ -1462,14 +1462,14 @@ var Swarm = class {
1462
1462
  swarmEvent
1463
1463
  }, {
1464
1464
  F: __dxlog_file4,
1465
- L: 170,
1465
+ L: 171,
1466
1466
  S: this,
1467
1467
  C: (f, a) => f(...a)
1468
1468
  });
1469
1469
  if (this._ctx.disposed) {
1470
1470
  log4("swarm event ignored for disposed swarm", void 0, {
1471
1471
  F: __dxlog_file4,
1472
- L: 173,
1472
+ L: 174,
1473
1473
  S: this,
1474
1474
  C: (f, a) => f(...a)
1475
1475
  });
@@ -1481,7 +1481,7 @@ var Swarm = class {
1481
1481
  peerId
1482
1482
  }, {
1483
1483
  F: __dxlog_file4,
1484
- L: 179,
1484
+ L: 180,
1485
1485
  S: this,
1486
1486
  C: (f, a) => f(...a)
1487
1487
  });
@@ -1496,7 +1496,7 @@ var Swarm = class {
1496
1496
  if (peer.connection?.state !== ConnectionState.CONNECTED) {
1497
1497
  void this._destroyPeer(peer.id, "peer left").catch((err) => log4.catch(err, void 0, {
1498
1498
  F: __dxlog_file4,
1499
- L: 190,
1499
+ L: 191,
1500
1500
  S: this,
1501
1501
  C: (f, a) => f(...a)
1502
1502
  }));
@@ -1506,7 +1506,7 @@ var Swarm = class {
1506
1506
  peer: swarmEvent.peerLeft.peer
1507
1507
  }, {
1508
1508
  F: __dxlog_file4,
1509
- L: 193,
1509
+ L: 194,
1510
1510
  S: this,
1511
1511
  C: (f, a) => f(...a)
1512
1512
  });
@@ -1519,14 +1519,14 @@ var Swarm = class {
1519
1519
  message
1520
1520
  }, {
1521
1521
  F: __dxlog_file4,
1522
- L: 202,
1522
+ L: 203,
1523
1523
  S: this,
1524
1524
  C: (f, a) => f(...a)
1525
1525
  });
1526
1526
  if (this._ctx.disposed) {
1527
1527
  log4("ignored for disposed swarm", void 0, {
1528
1528
  F: __dxlog_file4,
1529
- L: 204,
1529
+ L: 205,
1530
1530
  S: this,
1531
1531
  C: (f, a) => f(...a)
1532
1532
  });
@@ -1536,7 +1536,7 @@ var Swarm = class {
1536
1536
  }
1537
1537
  invariant4(message.author, void 0, {
1538
1538
  F: __dxlog_file4,
1539
- L: 209,
1539
+ L: 210,
1540
1540
  S: this,
1541
1541
  A: [
1542
1542
  "message.author",
@@ -1548,7 +1548,7 @@ var Swarm = class {
1548
1548
  message
1549
1549
  }, {
1550
1550
  F: __dxlog_file4,
1551
- L: 211,
1551
+ L: 212,
1552
1552
  S: this,
1553
1553
  C: (f, a) => f(...a)
1554
1554
  });
@@ -1561,7 +1561,7 @@ var Swarm = class {
1561
1561
  message
1562
1562
  }, {
1563
1563
  F: __dxlog_file4,
1564
- L: 215,
1564
+ L: 216,
1565
1565
  S: this,
1566
1566
  C: (f, a) => f(...a)
1567
1567
  });
@@ -1579,14 +1579,14 @@ var Swarm = class {
1579
1579
  message
1580
1580
  }, {
1581
1581
  F: __dxlog_file4,
1582
- L: 226,
1582
+ L: 227,
1583
1583
  S: this,
1584
1584
  C: (f, a) => f(...a)
1585
1585
  });
1586
1586
  if (this._ctx.disposed) {
1587
1587
  log4.info("ignored for offline swarm", void 0, {
1588
1588
  F: __dxlog_file4,
1589
- L: 228,
1589
+ L: 229,
1590
1590
  S: this,
1591
1591
  C: (f, a) => f(...a)
1592
1592
  });
@@ -1594,7 +1594,7 @@ var Swarm = class {
1594
1594
  }
1595
1595
  invariant4(message.recipient?.equals(this._ownPeerId), `Invalid signal peer id expected=${this.ownPeerId}, actual=${message.recipient}`, {
1596
1596
  F: __dxlog_file4,
1597
- L: 231,
1597
+ L: 232,
1598
1598
  S: this,
1599
1599
  A: [
1600
1600
  "message.recipient?.equals(this._ownPeerId)",
@@ -1603,7 +1603,7 @@ var Swarm = class {
1603
1603
  });
1604
1604
  invariant4(message.topic?.equals(this._topic), void 0, {
1605
1605
  F: __dxlog_file4,
1606
- L: 235,
1606
+ L: 236,
1607
1607
  S: this,
1608
1608
  A: [
1609
1609
  "message.topic?.equals(this._topic)",
@@ -1612,7 +1612,7 @@ var Swarm = class {
1612
1612
  });
1613
1613
  invariant4(message.author, void 0, {
1614
1614
  F: __dxlog_file4,
1615
- L: 236,
1615
+ L: 237,
1616
1616
  S: this,
1617
1617
  A: [
1618
1618
  "message.author",
@@ -1656,7 +1656,7 @@ var Swarm = class {
1656
1656
  peerId
1657
1657
  }, {
1658
1658
  F: __dxlog_file4,
1659
- L: 285,
1659
+ L: 286,
1660
1660
  S: this,
1661
1661
  C: (f, a) => f(...a)
1662
1662
  });
@@ -1680,7 +1680,7 @@ var Swarm = class {
1680
1680
  async _destroyPeer(peerId, reason) {
1681
1681
  invariant4(this._peers.has(peerId), void 0, {
1682
1682
  F: __dxlog_file4,
1683
- L: 307,
1683
+ L: 308,
1684
1684
  S: this,
1685
1685
  A: [
1686
1686
  "this._peers.has(peerId)",
@@ -1707,7 +1707,7 @@ var Swarm = class {
1707
1707
  } catch (err) {
1708
1708
  log4("initiation error", err, {
1709
1709
  F: __dxlog_file4,
1710
- L: 333,
1710
+ L: 334,
1711
1711
  S: this,
1712
1712
  C: (f, a) => f(...a)
1713
1713
  });
@@ -1735,7 +1735,7 @@ var Swarm = class {
1735
1735
  remoteId
1736
1736
  }, {
1737
1737
  F: __dxlog_file4,
1738
- L: 360,
1738
+ L: 361,
1739
1739
  S: this,
1740
1740
  C: (f, a) => f(...a)
1741
1741
  });
@@ -1752,7 +1752,7 @@ var Swarm = class {
1752
1752
  remoteId
1753
1753
  }, {
1754
1754
  F: __dxlog_file4,
1755
- L: 374,
1755
+ L: 375,
1756
1756
  S: this,
1757
1757
  C: (f, a) => f(...a)
1758
1758
  });
@@ -1762,7 +1762,7 @@ var Swarm = class {
1762
1762
  remoteId
1763
1763
  }, {
1764
1764
  F: __dxlog_file4,
1765
- L: 377,
1765
+ L: 378,
1766
1766
  S: this,
1767
1767
  C: (f, a) => f(...a)
1768
1768
  });
@@ -3244,6 +3244,7 @@ import { ConnectionResetError as ConnectionResetError3, TimeoutError as TimeoutE
3244
3244
  import { ConnectionState as ConnectionState4 } from "@dxos/protocols/proto/dxos/mesh/bridge";
3245
3245
  import { arrayToBuffer } from "@dxos/util";
3246
3246
  var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport-proxy.ts";
3247
+ var RPC_TIMEOUT = 1e4;
3247
3248
  var RESP_MIN_THRESHOLD = 500;
3248
3249
  var TIMEOUT_THRESHOLD = 10;
3249
3250
  var SimplePeerTransportProxy = class {
@@ -3259,12 +3260,14 @@ var SimplePeerTransportProxy = class {
3259
3260
  this._serviceStream = this._params.bridgeService.open({
3260
3261
  proxyId: this._proxyId,
3261
3262
  initiator: this._params.initiator
3263
+ }, {
3264
+ timeout: RPC_TIMEOUT
3262
3265
  });
3263
3266
  this._serviceStream.waitUntilReady().then(() => {
3264
3267
  this._serviceStream.subscribe(async (event) => {
3265
3268
  log13("SimplePeerTransportProxy: event", event, {
3266
3269
  F: __dxlog_file14,
3267
- L: 59,
3270
+ L: 63,
3268
3271
  S: this,
3269
3272
  C: (f, a) => f(...a)
3270
3273
  });
@@ -3283,12 +3286,12 @@ var SimplePeerTransportProxy = class {
3283
3286
  proxyId: this._proxyId,
3284
3287
  payload: chunk
3285
3288
  }, {
3286
- timeout: 1e4
3289
+ timeout: RPC_TIMEOUT
3287
3290
  }).then(() => {
3288
3291
  if (performance.now() - then > RESP_MIN_THRESHOLD) {
3289
3292
  log13("slow response, delaying callback", void 0, {
3290
3293
  F: __dxlog_file14,
3291
- L: 83,
3294
+ L: 87,
3292
3295
  S: this,
3293
3296
  C: (f, a) => f(...a)
3294
3297
  });
@@ -3300,11 +3303,11 @@ var SimplePeerTransportProxy = class {
3300
3303
  }, (err) => {
3301
3304
  if (err instanceof TimeoutError3 || err.constructor.name === "TimeoutError") {
3302
3305
  if (this._timeoutCount++ > TIMEOUT_THRESHOLD) {
3303
- throw new TimeoutError3(`too many timeoutes (${this._timeoutCount} > ${TIMEOUT_THRESHOLD}`);
3306
+ throw new TimeoutError3(`too many timeouts (${this._timeoutCount} > ${TIMEOUT_THRESHOLD}`);
3304
3307
  } else {
3305
3308
  log13("timeout error, but still invoking callback", void 0, {
3306
3309
  F: __dxlog_file14,
3307
- L: 95,
3310
+ L: 99,
3308
3311
  S: this,
3309
3312
  C: (f, a) => f(...a)
3310
3313
  });
@@ -3313,7 +3316,7 @@ var SimplePeerTransportProxy = class {
3313
3316
  } else {
3314
3317
  log13.catch(err, void 0, {
3315
3318
  F: __dxlog_file14,
3316
- L: 99,
3319
+ L: 103,
3317
3320
  S: this,
3318
3321
  C: (f, a) => f(...a)
3319
3322
  });
@@ -3326,7 +3329,7 @@ var SimplePeerTransportProxy = class {
3326
3329
  err
3327
3330
  }, {
3328
3331
  F: __dxlog_file14,
3329
- L: 107,
3332
+ L: 111,
3330
3333
  S: this,
3331
3334
  C: (f, a) => f(...a)
3332
3335
  });
@@ -3334,7 +3337,7 @@ var SimplePeerTransportProxy = class {
3334
3337
  this._params.stream.pipe(proxyStream);
3335
3338
  }, (error) => log13.catch(error, void 0, {
3336
3339
  F: __dxlog_file14,
3337
- L: 112,
3340
+ L: 116,
3338
3341
  S: this,
3339
3342
  C: (f, a) => f(...a)
3340
3343
  }));
@@ -3364,16 +3367,22 @@ var SimplePeerTransportProxy = class {
3364
3367
  this._params.bridgeService.sendSignal({
3365
3368
  proxyId: this._proxyId,
3366
3369
  signal
3370
+ }, {
3371
+ timeout: RPC_TIMEOUT
3367
3372
  }).catch((err) => this.errors.raise(decodeError(err)));
3368
3373
  }
3369
3374
  async getDetails() {
3370
3375
  return (await this._params.bridgeService.getDetails({
3371
3376
  proxyId: this._proxyId
3377
+ }, {
3378
+ timeout: RPC_TIMEOUT
3372
3379
  })).details;
3373
3380
  }
3374
3381
  async getStats() {
3375
3382
  return (await this._params.bridgeService.getStats({
3376
3383
  proxyId: this._proxyId
3384
+ }, {
3385
+ timeout: RPC_TIMEOUT
3377
3386
  })).stats;
3378
3387
  }
3379
3388
  // TODO(burdon): Move open from constructor.
@@ -3386,11 +3395,13 @@ var SimplePeerTransportProxy = class {
3386
3395
  try {
3387
3396
  await this._params.bridgeService.close({
3388
3397
  proxyId: this._proxyId
3398
+ }, {
3399
+ timeout: RPC_TIMEOUT
3389
3400
  });
3390
3401
  } catch (err) {
3391
3402
  log13.catch(err, void 0, {
3392
3403
  F: __dxlog_file14,
3393
- L: 171,
3404
+ L: 179,
3394
3405
  S: this,
3395
3406
  C: (f, a) => f(...a)
3396
3407
  });
@@ -3426,7 +3437,7 @@ var SimplePeerTransportProxyFactory = class {
3426
3437
  createTransport(options) {
3427
3438
  invariant13(this._bridgeService, "SimplePeerTransportProxyFactory is not ready to open connections", {
3428
3439
  F: __dxlog_file14,
3429
- L: 208,
3440
+ L: 216,
3430
3441
  S: this,
3431
3442
  A: [
3432
3443
  "this._bridgeService",
@@ -3952,4 +3963,4 @@ export {
3952
3963
  TcpTransport,
3953
3964
  createTeleportProtocolFactory
3954
3965
  };
3955
- //# sourceMappingURL=chunk-KEN4UCZF.mjs.map
3966
+ //# sourceMappingURL=chunk-OIR45T43.mjs.map