@dxos/network-manager 0.1.41 → 0.1.45-next.45667d4

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.
Files changed (64) hide show
  1. package/dist/lib/browser/{chunk-JAQBUAX3.mjs → chunk-UTCOIPSK.mjs} +101 -136
  2. package/dist/lib/browser/chunk-UTCOIPSK.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/testing/index.mjs +3 -2
  6. package/dist/lib/browser/testing/index.mjs.map +3 -3
  7. package/dist/lib/node/index.cjs +100 -135
  8. package/dist/lib/node/index.cjs.map +3 -3
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/testing/index.cjs +102 -136
  11. package/dist/lib/node/testing/index.cjs.map +3 -3
  12. package/dist/types/src/network-manager.d.ts +4 -6
  13. package/dist/types/src/network-manager.d.ts.map +1 -1
  14. package/dist/types/src/signal/message-router.d.ts +1 -1
  15. package/dist/types/src/signal/message-router.d.ts.map +1 -1
  16. package/dist/types/src/swarm/connection.d.ts +0 -4
  17. package/dist/types/src/swarm/connection.d.ts.map +1 -1
  18. package/dist/types/src/swarm/peer.d.ts +0 -1
  19. package/dist/types/src/swarm/peer.d.ts.map +1 -1
  20. package/dist/types/src/swarm/swarm-mapper.d.ts +1 -1
  21. package/dist/types/src/swarm/swarm-mapper.d.ts.map +1 -1
  22. package/dist/types/src/swarm/swarm.d.ts.map +1 -1
  23. package/dist/types/src/testing/test-builder.d.ts +1 -1
  24. package/dist/types/src/testing/test-builder.d.ts.map +1 -1
  25. package/dist/types/src/transport/transport.d.ts +1 -1
  26. package/dist/types/src/transport/transport.d.ts.map +1 -1
  27. package/dist/types/src/transport/webrtc-transport-proxy.d.ts +1 -1
  28. package/dist/types/src/transport/webrtc-transport-proxy.d.ts.map +1 -1
  29. package/dist/types/src/transport/webrtc-transport.d.ts +1 -2
  30. package/dist/types/src/transport/webrtc-transport.d.ts.map +1 -1
  31. package/dist/types/src/types.d.ts +1 -1
  32. package/dist/types/src/types.d.ts.map +1 -1
  33. package/dist/types/src/wire-protocol.d.ts +2 -2
  34. package/dist/types/src/wire-protocol.d.ts.map +1 -1
  35. package/package.json +17 -17
  36. package/src/connection-log.ts +4 -4
  37. package/src/network-manager.ts +6 -14
  38. package/src/signal/integration.test.ts +19 -19
  39. package/src/signal/message-router.test.ts +30 -30
  40. package/src/signal/message-router.ts +15 -15
  41. package/src/swarm/connection.ts +10 -17
  42. package/src/swarm/peer.ts +6 -9
  43. package/src/swarm/swarm-mapper.ts +3 -3
  44. package/src/swarm/swarm.test.ts +14 -14
  45. package/src/swarm/swarm.ts +14 -15
  46. package/src/testing/test-builder.ts +23 -12
  47. package/src/testing/test-wire-protocol.ts +2 -2
  48. package/src/tests/basic-test-suite.ts +8 -8
  49. package/src/tests/memory-transport.test.ts +4 -4
  50. package/src/tests/property-test-suite.ts +16 -16
  51. package/src/tests/utils.ts +2 -2
  52. package/src/tests/webrtc-transport.test.ts +16 -2
  53. package/src/topology/mmst-topology.ts +1 -1
  54. package/src/topology/star-topology.ts +1 -1
  55. package/src/transport/memory-transport.test.ts +4 -4
  56. package/src/transport/memory-transport.ts +3 -3
  57. package/src/transport/webrtc-simple-peer.test.ts +1 -1
  58. package/src/transport/webrtc-transport-proxy.test.ts +18 -18
  59. package/src/transport/webrtc-transport-proxy.ts +2 -2
  60. package/src/transport/webrtc-transport-service.ts +13 -13
  61. package/src/transport/webrtc-transport.test.ts +3 -3
  62. package/src/transport/webrtc-transport.ts +6 -13
  63. package/src/wire-protocol.ts +2 -2
  64. package/dist/lib/browser/chunk-JAQBUAX3.mjs.map +0 -7
@@ -127,9 +127,6 @@ var Connection = class {
127
127
  this.stateChanged = new import_async.Event();
128
128
  this.errors = new import_debug.ErrorStream();
129
129
  this._instanceId = import_keys.PublicKey.random().toHex();
130
- this._performance = {
131
- signalsSent: 0
132
- };
133
130
  }
134
131
  get state() {
135
132
  return this._state;
@@ -146,23 +143,22 @@ var Connection = class {
146
143
  // TODO(burdon): Make async?
147
144
  openConnection() {
148
145
  (0, import_node_assert.default)(this._state === ConnectionState.INITIAL, "Invalid state.");
149
- this._changeState(ConnectionState.CONNECTING);
150
- import_log.log.trace("dxos.mesh.connection", import_protocols.trace.begin({
151
- id: this._instanceId,
152
- parentId: this._traceParent
146
+ import_log.log.trace("dxos.mesh.connection.open-connection", import_protocols.trace.begin({
147
+ id: this._instanceId
153
148
  }), {
154
149
  file: "connection.ts",
155
- line: 97,
150
+ line: 92,
156
151
  scope: this,
157
152
  callSite: (f, a) => f(...a)
158
153
  });
154
+ this._changeState(ConnectionState.CONNECTING);
159
155
  this._protocol.initialize().catch((err) => {
160
156
  this.errors.raise(err);
161
157
  });
162
158
  this._protocol.stream.on("close", () => {
163
159
  (0, import_log.log)("protocol stream closed", {}, {
164
160
  file: "connection.ts",
165
- line: 106,
161
+ line: 103,
166
162
  scope: this,
167
163
  callSite: (f, a) => f(...a)
168
164
  });
@@ -172,18 +168,15 @@ var Connection = class {
172
168
  this._transport = this._transportFactory.createTransport({
173
169
  initiator: this.initiator,
174
170
  stream: this._protocol.stream,
175
- sendSignal: async (signal) => {
176
- this._performance.signalsSent++;
177
- await this._signalMessaging.signal({
178
- author: this.ownId,
179
- recipient: this.remoteId,
180
- sessionId: this.sessionId,
181
- topic: this.topic,
182
- data: {
183
- signal
184
- }
185
- });
186
- }
171
+ sendSignal: async (signal) => this._signalMessaging.signal({
172
+ author: this.ownId,
173
+ recipient: this.remoteId,
174
+ sessionId: this.sessionId,
175
+ topic: this.topic,
176
+ data: {
177
+ signal
178
+ }
179
+ })
187
180
  });
188
181
  this._transport.connected.once(() => {
189
182
  this._changeState(ConnectionState.CONNECTED);
@@ -201,6 +194,14 @@ var Connection = class {
201
194
  void this._transport.signal(signal);
202
195
  }
203
196
  this._bufferedSignals = [];
197
+ import_log.log.trace("dxos.mesh.connection.open-connection", import_protocols.trace.end({
198
+ id: this._instanceId
199
+ }), {
200
+ file: "connection.ts",
201
+ line: 143,
202
+ scope: this,
203
+ callSite: (f, a) => f(...a)
204
+ });
204
205
  }
205
206
  async close() {
206
207
  var _a;
@@ -212,7 +213,7 @@ var Connection = class {
212
213
  peerId: this.ownId
213
214
  }, {
214
215
  file: "connection.ts",
215
- line: 156,
216
+ line: 153,
216
217
  scope: this,
217
218
  callSite: (f, a) => f(...a)
218
219
  });
@@ -221,7 +222,7 @@ var Connection = class {
221
222
  } catch (err) {
222
223
  import_log.log.catch(err, {}, {
223
224
  file: "connection.ts",
224
- line: 162,
225
+ line: 159,
225
226
  scope: this,
226
227
  callSite: (f, a) => f(...a)
227
228
  });
@@ -231,7 +232,7 @@ var Connection = class {
231
232
  } catch (err1) {
232
233
  import_log.log.catch(err1, {}, {
233
234
  file: "connection.ts",
234
- line: 169,
235
+ line: 166,
235
236
  scope: this,
236
237
  callSite: (f, a) => f(...a)
237
238
  });
@@ -240,23 +241,11 @@ var Connection = class {
240
241
  peerId: this.ownId
241
242
  }, {
242
243
  file: "connection.ts",
243
- line: 172,
244
+ line: 169,
244
245
  scope: this,
245
246
  callSite: (f, a) => f(...a)
246
247
  });
247
248
  this._changeState(ConnectionState.CLOSED);
248
- import_log.log.trace("dxos.mesh.connection", import_protocols.trace.end({
249
- id: this._instanceId,
250
- status: "ok",
251
- data: {
252
- performance: this._performance
253
- }
254
- }), {
255
- file: "connection.ts",
256
- line: 174,
257
- scope: this,
258
- callSite: (f, a) => f(...a)
259
- });
260
249
  }
261
250
  async signal(msg) {
262
251
  var _a, _b;
@@ -264,7 +253,7 @@ var Connection = class {
264
253
  if (!msg.sessionId.equals(this.sessionId)) {
265
254
  (0, import_log.log)("dropping signal for incorrect session id", {}, {
266
255
  file: "connection.ts",
267
- line: 183,
256
+ line: 176,
268
257
  scope: this,
269
258
  callSite: (f, a) => f(...a)
270
259
  });
@@ -280,7 +269,7 @@ var Connection = class {
280
269
  msg: msg.data
281
270
  }, {
282
271
  file: "connection.ts",
283
- line: 191,
272
+ line: 184,
284
273
  scope: this,
285
274
  callSite: (f, a) => f(...a)
286
275
  });
@@ -294,7 +283,7 @@ var Connection = class {
294
283
  msg: msg.data
295
284
  }, {
296
285
  file: "connection.ts",
297
- line: 197,
286
+ line: 190,
298
287
  scope: this,
299
288
  callSite: (f, a) => f(...a)
300
289
  });
@@ -307,7 +296,7 @@ var Connection = class {
307
296
  peerId: this.ownId
308
297
  }, {
309
298
  file: "connection.ts",
310
- line: 202,
299
+ line: 195,
311
300
  scope: this,
312
301
  callSite: (f, a) => f(...a)
313
302
  });
@@ -540,7 +529,7 @@ var Peer = class {
540
529
  peerId: this.localPeerId
541
530
  }, {
542
531
  file: "peer.ts",
543
- line: 107,
532
+ line: 105,
544
533
  scope: this,
545
534
  callSite: (f, a) => f(...a)
546
535
  });
@@ -567,7 +556,7 @@ var Peer = class {
567
556
  err
568
557
  }, {
569
558
  file: "peer.ts",
570
- line: 131,
559
+ line: 129,
571
560
  scope: this,
572
561
  callSite: (f, a) => f(...a)
573
562
  });
@@ -596,7 +585,7 @@ var Peer = class {
596
585
  sessionId
597
586
  }, {
598
587
  file: "peer.ts",
599
- line: 149,
588
+ line: 147,
600
589
  scope: this,
601
590
  callSite: (f, a) => f(...a)
602
591
  });
@@ -619,14 +608,14 @@ var Peer = class {
619
608
  remoteId: this.id
620
609
  }, {
621
610
  file: "peer.ts",
622
- line: 161,
611
+ line: 159,
623
612
  scope: this,
624
613
  callSite: (f, a) => f(...a)
625
614
  });
626
615
  if (connection.state !== ConnectionState.INITIAL) {
627
616
  (0, import_log3.log)("ignoring response", {}, {
628
617
  file: "peer.ts",
629
- line: 163,
618
+ line: 161,
630
619
  scope: this,
631
620
  callSite: (f, a) => f(...a)
632
621
  });
@@ -646,7 +635,7 @@ var Peer = class {
646
635
  err
647
636
  }, {
648
637
  file: "peer.ts",
649
- line: 174,
638
+ line: 172,
650
639
  scope: this,
651
640
  callSite: (f, a) => f(...a)
652
641
  });
@@ -670,7 +659,7 @@ var Peer = class {
670
659
  sessionId
671
660
  }, {
672
661
  file: "peer.ts",
673
- line: 188,
662
+ line: 186,
674
663
  scope: this,
675
664
  callSite: (f, a) => f(...a)
676
665
  });
@@ -691,7 +680,6 @@ var Peer = class {
691
680
  }),
692
681
  this._transportFactory
693
682
  );
694
- connection._traceParent = this._traceParent;
695
683
  this._callbacks.onInitiated(connection);
696
684
  void ((_a = this._connectionCtx) == null ? void 0 : _a.dispose());
697
685
  this._connectionCtx = this._ctx.derive();
@@ -711,7 +699,7 @@ var Peer = class {
711
699
  initiator
712
700
  }, {
713
701
  file: "peer.ts",
714
- line: 224,
702
+ line: 221,
715
703
  scope: this,
716
704
  callSite: (f, a) => f(...a)
717
705
  });
@@ -741,7 +729,7 @@ var Peer = class {
741
729
  err
742
730
  }, {
743
731
  file: "peer.ts",
744
- line: 252,
732
+ line: 249,
745
733
  scope: this,
746
734
  callSite: (f, a) => f(...a)
747
735
  });
@@ -760,7 +748,7 @@ var Peer = class {
760
748
  sessionId: connection.sessionId
761
749
  }, {
762
750
  file: "peer.ts",
763
- line: 268,
751
+ line: 265,
764
752
  scope: this,
765
753
  callSite: (f, a) => f(...a)
766
754
  });
@@ -770,7 +758,7 @@ var Peer = class {
770
758
  sessionId: connection.sessionId
771
759
  }, {
772
760
  file: "peer.ts",
773
- line: 274,
761
+ line: 271,
774
762
  scope: this,
775
763
  callSite: (f, a) => f(...a)
776
764
  });
@@ -781,7 +769,7 @@ var Peer = class {
781
769
  message
782
770
  }, {
783
771
  file: "peer.ts",
784
- line: 279,
772
+ line: 276,
785
773
  scope: this,
786
774
  callSite: (f, a) => f(...a)
787
775
  });
@@ -797,7 +785,7 @@ var Peer = class {
797
785
  topic: this.topic
798
786
  }, {
799
787
  file: "peer.ts",
800
- line: 288,
788
+ line: 285,
801
789
  scope: this,
802
790
  callSite: (f, a) => f(...a)
803
791
  });
@@ -851,11 +839,23 @@ var Swarm = class {
851
839
  this.connected = new import_async3.Event();
852
840
  this.errors = new import_debug2.ErrorStream();
853
841
  this._instanceId = import_keys4.PublicKey.random().toHex();
842
+ import_log4.log.trace("dxos.mesh.swarm.constructor", import_protocols3.trace.begin({
843
+ id: this._instanceId,
844
+ data: {
845
+ topic: this._topic.toHex(),
846
+ peerId: this._ownPeerId.toHex()
847
+ }
848
+ }), {
849
+ file: "swarm.ts",
850
+ line: 84,
851
+ scope: this,
852
+ callSite: (f, a) => f(...a)
853
+ });
854
854
  (0, import_log4.log)("creating swarm", {
855
855
  peerId: _ownPeerId
856
856
  }, {
857
857
  file: "swarm.ts",
858
- line: 84,
858
+ line: 88,
859
859
  scope: this,
860
860
  callSite: (f, a) => f(...a)
861
861
  });
@@ -872,19 +872,15 @@ var Swarm = class {
872
872
  onMessage: async (message) => await this._swarmMessenger.receiveMessage(message)
873
873
  }).catch((error) => import_log4.log.catch(error, {}, {
874
874
  file: "swarm.ts",
875
- line: 100,
875
+ line: 104,
876
876
  scope: this,
877
877
  callSite: (f, a) => f(...a)
878
878
  }));
879
- import_log4.log.trace("dxos.mesh.swarm", import_protocols3.trace.begin({
880
- id: this._instanceId,
881
- data: {
882
- topic: this._topic.toHex(),
883
- peerId: this._ownPeerId.toHex()
884
- }
879
+ import_log4.log.trace("dxos.mesh.swarm.constructor", import_protocols3.trace.end({
880
+ id: this._instanceId
885
881
  }), {
886
882
  file: "swarm.ts",
887
- line: 102,
883
+ line: 106,
888
884
  scope: this,
889
885
  callSite: (f, a) => f(...a)
890
886
  });
@@ -908,7 +904,7 @@ var Swarm = class {
908
904
  async destroy() {
909
905
  (0, import_log4.log)("destroying...", {}, {
910
906
  file: "swarm.ts",
911
- line: 133,
907
+ line: 134,
912
908
  scope: this,
913
909
  callSite: (f, a) => f(...a)
914
910
  });
@@ -916,14 +912,6 @@ var Swarm = class {
916
912
  await this._topology.destroy();
917
913
  await Promise.all(Array.from(this._peers.keys()).map((key) => this._destroyPeer(key)));
918
914
  (0, import_log4.log)("destroyed", {}, {
919
- file: "swarm.ts",
920
- line: 137,
921
- scope: this,
922
- callSite: (f, a) => f(...a)
923
- });
924
- import_log4.log.trace("dxos.mesh.swarm", import_protocols3.trace.end({
925
- id: this._instanceId
926
- }), {
927
915
  file: "swarm.ts",
928
916
  line: 138,
929
917
  scope: this,
@@ -1119,7 +1107,6 @@ var Swarm = class {
1119
1107
  this._topology.update();
1120
1108
  }
1121
1109
  });
1122
- peer._traceParent = this._instanceId;
1123
1110
  this._peers.set(peerId, peer);
1124
1111
  }
1125
1112
  return peer;
@@ -1146,7 +1133,7 @@ var Swarm = class {
1146
1133
  } catch (err) {
1147
1134
  import_log4.log.warn("initiation error", err, {
1148
1135
  file: "swarm.ts",
1149
- line: 320,
1136
+ line: 319,
1150
1137
  scope: this,
1151
1138
  callSite: (f, a) => f(...a)
1152
1139
  });
@@ -1174,7 +1161,7 @@ var Swarm = class {
1174
1161
  remoteId
1175
1162
  }, {
1176
1163
  file: "swarm.ts",
1177
- line: 347,
1164
+ line: 346,
1178
1165
  scope: this,
1179
1166
  callSite: (f, a) => f(...a)
1180
1167
  });
@@ -1191,7 +1178,7 @@ var Swarm = class {
1191
1178
  remoteId
1192
1179
  }, {
1193
1180
  file: "swarm.ts",
1194
- line: 361,
1181
+ line: 360,
1195
1182
  scope: this,
1196
1183
  callSite: (f, a) => f(...a)
1197
1184
  });
@@ -1201,7 +1188,7 @@ var Swarm = class {
1201
1188
  remoteId
1202
1189
  }, {
1203
1190
  file: "swarm.ts",
1204
- line: 364,
1191
+ line: 363,
1205
1192
  scope: this,
1206
1193
  callSite: (f, a) => f(...a)
1207
1194
  });
@@ -1379,7 +1366,6 @@ var NetworkManager = class {
1379
1366
  this.connectionStateChanged = new import_async6.Event();
1380
1367
  this.topicsUpdated = new import_async6.Event();
1381
1368
  this._instanceId = import_keys7.PublicKey.random().toHex();
1382
- signalManager._traceParent = this._instanceId;
1383
1369
  this._transportFactory = transportFactory;
1384
1370
  this._signalManager = signalManager;
1385
1371
  this._signalManager.swarmEvent.on(({ topic, swarmEvent: event }) => {
@@ -1389,7 +1375,6 @@ var NetworkManager = class {
1389
1375
  this._messenger = new import_messaging.Messenger({
1390
1376
  signalManager: this._signalManager
1391
1377
  });
1392
- this._messenger._traceParent = this._instanceId;
1393
1378
  this._signalConnection = {
1394
1379
  join: (opts) => this._signalManager.join(opts),
1395
1380
  leave: (opts) => this._signalManager.leave(opts)
@@ -1402,10 +1387,6 @@ var NetworkManager = class {
1402
1387
  get connectionLog() {
1403
1388
  return this._connectionLog;
1404
1389
  }
1405
- // TODO(burdon): Remove access (Devtools only).
1406
- get signalManager() {
1407
- return this._signalManager;
1408
- }
1409
1390
  get connectionState() {
1410
1391
  return this._connectionState;
1411
1392
  }
@@ -1420,24 +1401,31 @@ var NetworkManager = class {
1420
1401
  return this._swarms.get(topic);
1421
1402
  }
1422
1403
  async open() {
1423
- import_log6.log.trace("dxos.mesh.network-manager", import_protocols4.trace.begin({
1424
- id: this._instanceId,
1425
- parentId: this._traceParent
1404
+ import_log6.log.trace("dxos.mesh.network-manager.open", import_protocols4.trace.begin({
1405
+ id: this._instanceId
1426
1406
  }), {
1427
1407
  file: "network-manager.ts",
1428
- line: 135,
1408
+ line: 127,
1429
1409
  scope: this,
1430
1410
  callSite: (f, a) => f(...a)
1431
1411
  });
1432
1412
  await this._messenger.open();
1433
1413
  await this._signalManager.open();
1414
+ import_log6.log.trace("dxos.mesh.network-manager.open", import_protocols4.trace.end({
1415
+ id: this._instanceId
1416
+ }), {
1417
+ file: "network-manager.ts",
1418
+ line: 130,
1419
+ scope: this,
1420
+ callSite: (f, a) => f(...a)
1421
+ });
1434
1422
  }
1435
1423
  async close() {
1436
1424
  for (const topic of this._swarms.keys()) {
1437
1425
  await this.leaveSwarm(topic).catch((err) => {
1438
1426
  (0, import_log6.log)(err, {}, {
1439
1427
  file: "network-manager.ts",
1440
- line: 143,
1428
+ line: 136,
1441
1429
  scope: this,
1442
1430
  callSite: (f, a) => f(...a)
1443
1431
  });
@@ -1445,14 +1433,6 @@ var NetworkManager = class {
1445
1433
  }
1446
1434
  await this._messenger.close();
1447
1435
  await this._signalManager.close();
1448
- import_log6.log.trace("dxos.mesh.network-manager", import_protocols4.trace.end({
1449
- id: this._instanceId
1450
- }), {
1451
- file: "network-manager.ts",
1452
- line: 149,
1453
- scope: this,
1454
- callSite: (f, a) => f(...a)
1455
- });
1456
1436
  }
1457
1437
  /**
1458
1438
  * Join the swarm.
@@ -1472,7 +1452,7 @@ var NetworkManager = class {
1472
1452
  topology: topology.toString()
1473
1453
  }, {
1474
1454
  file: "network-manager.ts",
1475
- line: 170,
1455
+ line: 162,
1476
1456
  scope: this,
1477
1457
  callSite: (f, a) => f(...a)
1478
1458
  });
@@ -1482,7 +1462,7 @@ var NetworkManager = class {
1482
1462
  error
1483
1463
  }, {
1484
1464
  file: "network-manager.ts",
1485
- line: 173,
1465
+ line: 165,
1486
1466
  scope: this,
1487
1467
  callSite: (f, a) => f(...a)
1488
1468
  });
@@ -1493,7 +1473,7 @@ var NetworkManager = class {
1493
1473
  peerId
1494
1474
  }).catch((error) => import_log6.log.catch(error, {}, {
1495
1475
  file: "network-manager.ts",
1496
- line: 177,
1476
+ line: 169,
1497
1477
  scope: this,
1498
1478
  callSite: (f, a) => f(...a)
1499
1479
  }));
@@ -1505,7 +1485,7 @@ var NetworkManager = class {
1505
1485
  count: this._swarms.size
1506
1486
  }, {
1507
1487
  file: "network-manager.ts",
1508
- line: 182,
1488
+ line: 174,
1509
1489
  scope: this,
1510
1490
  callSite: (f, a) => f(...a)
1511
1491
  });
@@ -1519,21 +1499,13 @@ var NetworkManager = class {
1519
1499
  async leaveSwarm(topic) {
1520
1500
  var _a;
1521
1501
  if (!this._swarms.has(topic)) {
1522
- import_log6.log.warn("swarm not open", {
1523
- topic: import_keys7.PublicKey.from(topic).truncate()
1524
- }, {
1525
- file: "network-manager.ts",
1526
- line: 194,
1527
- scope: this,
1528
- callSite: (f, a) => f(...a)
1529
- });
1530
1502
  return;
1531
1503
  }
1532
1504
  (0, import_log6.log)("leaving", {
1533
1505
  topic: import_keys7.PublicKey.from(topic)
1534
1506
  }, {
1535
1507
  file: "network-manager.ts",
1536
- line: 198,
1508
+ line: 190,
1537
1509
  scope: this,
1538
1510
  callSite: (f, a) => f(...a)
1539
1511
  });
@@ -1554,7 +1526,7 @@ var NetworkManager = class {
1554
1526
  count: this._swarms.size
1555
1527
  }, {
1556
1528
  file: "network-manager.ts",
1557
- line: 212,
1529
+ line: 204,
1558
1530
  scope: this,
1559
1531
  callSite: (f, a) => f(...a)
1560
1532
  });
@@ -1813,21 +1785,17 @@ var WebRTCTransport = class {
1813
1785
  this.connected = new import_async8.Event();
1814
1786
  this.errors = new import_debug5.ErrorStream();
1815
1787
  this._instanceId = import_keys9.PublicKey.random().toHex();
1816
- this._performance = {
1817
- bytesSent: 0,
1818
- bytesReceived: 0
1819
- };
1820
- import_log10.log.trace("dxos.mesh.webrtc-transport", import_protocols5.trace.begin({
1788
+ import_log10.log.trace("dxos.mesh.webrtc-transport.constructor", import_protocols5.trace.begin({
1821
1789
  id: this._instanceId
1822
1790
  }), {
1823
1791
  file: "webrtc-transport.ts",
1824
- line: 43,
1792
+ line: 39,
1825
1793
  scope: this,
1826
1794
  callSite: (f, a) => f(...a)
1827
1795
  });
1828
1796
  (0, import_log10.log)("created connection", params, {
1829
1797
  file: "webrtc-transport.ts",
1830
- line: 44,
1798
+ line: 40,
1831
1799
  scope: this,
1832
1800
  callSite: (f, a) => f(...a)
1833
1801
  });
@@ -1839,7 +1807,7 @@ var WebRTCTransport = class {
1839
1807
  this._peer.on("signal", async (data) => {
1840
1808
  (0, import_log10.log)("signal", data, {
1841
1809
  file: "webrtc-transport.ts",
1842
- line: 52,
1810
+ line: 48,
1843
1811
  scope: this,
1844
1812
  callSite: (f, a) => f(...a)
1845
1813
  });
@@ -1852,7 +1820,7 @@ var WebRTCTransport = class {
1852
1820
  this._peer.on("connect", () => {
1853
1821
  (0, import_log10.log)("connected", {}, {
1854
1822
  file: "webrtc-transport.ts",
1855
- line: 57,
1823
+ line: 53,
1856
1824
  scope: this,
1857
1825
  callSite: (f, a) => f(...a)
1858
1826
  });
@@ -1862,7 +1830,7 @@ var WebRTCTransport = class {
1862
1830
  this._peer.on("close", async () => {
1863
1831
  (0, import_log10.log)("closed", {}, {
1864
1832
  file: "webrtc-transport.ts",
1865
- line: 63,
1833
+ line: 59,
1866
1834
  scope: this,
1867
1835
  callSite: (f, a) => f(...a)
1868
1836
  });
@@ -1880,7 +1848,7 @@ var WebRTCTransport = class {
1880
1848
  stats
1881
1849
  }, {
1882
1850
  file: "webrtc-transport.ts",
1883
- line: 75,
1851
+ line: 71,
1884
1852
  scope: this,
1885
1853
  callSite: (f, a) => f(...a)
1886
1854
  });
@@ -1890,11 +1858,19 @@ var WebRTCTransport = class {
1890
1858
  }
1891
1859
  await this.destroy();
1892
1860
  });
1861
+ import_log10.log.trace("dxos.mesh.webrtc-transport.constructor", import_protocols5.trace.end({
1862
+ id: this._instanceId
1863
+ }), {
1864
+ file: "webrtc-transport.ts",
1865
+ line: 81,
1866
+ scope: this,
1867
+ callSite: (f, a) => f(...a)
1868
+ });
1893
1869
  }
1894
1870
  async destroy() {
1895
1871
  (0, import_log10.log)("closing...", {}, {
1896
1872
  file: "webrtc-transport.ts",
1897
- line: 88,
1873
+ line: 85,
1898
1874
  scope: this,
1899
1875
  callSite: (f, a) => f(...a)
1900
1876
  });
@@ -1904,18 +1880,7 @@ var WebRTCTransport = class {
1904
1880
  this.closed.emit();
1905
1881
  (0, import_log10.log)("closed", {}, {
1906
1882
  file: "webrtc-transport.ts",
1907
- line: 93,
1908
- scope: this,
1909
- callSite: (f, a) => f(...a)
1910
- });
1911
- import_log10.log.trace("dxos.mesh.webrtc-transport", import_protocols5.trace.end({
1912
- id: this._instanceId,
1913
- data: {
1914
- performance: this._performance
1915
- }
1916
- }), {
1917
- file: "webrtc-transport.ts",
1918
- line: 94,
1883
+ line: 90,
1919
1884
  scope: this,
1920
1885
  callSite: (f, a) => f(...a)
1921
1886
  });
@@ -2281,6 +2246,7 @@ var TestPeer = class {
2281
2246
  this.testBuilder = testBuilder;
2282
2247
  this.peerId = import_keys13.PublicKey.random();
2283
2248
  this._swarms = new import_util9.ComplexMap(import_keys13.PublicKey.hash);
2249
+ this._signalManager = this.testBuilder.createSignalManager();
2284
2250
  this._networkManager = this.createNetworkManager();
2285
2251
  }
2286
2252
  // TODO(burdon): Move to TestBuilder.
@@ -2320,7 +2286,7 @@ var TestPeer = class {
2320
2286
  }
2321
2287
  }
2322
2288
  return new NetworkManager({
2323
- signalManager: this.testBuilder.createSignalManager(),
2289
+ signalManager: this._signalManager,
2324
2290
  transportFactory
2325
2291
  });
2326
2292
  }