@dxos/network-manager 0.1.56-main.fd2d497 → 0.1.56-next.71eb10c

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 (35) hide show
  1. package/dist/lib/browser/{chunk-5TRIVLI6.mjs → chunk-WQ3YXGWP.mjs} +91 -75
  2. package/dist/lib/browser/chunk-WQ3YXGWP.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 +1 -1
  6. package/dist/lib/node/index.cjs +90 -74
  7. package/dist/lib/node/index.cjs.map +3 -3
  8. package/dist/lib/node/meta.json +1 -1
  9. package/dist/lib/node/testing/index.cjs +90 -74
  10. package/dist/lib/node/testing/index.cjs.map +3 -3
  11. package/dist/types/src/connection-log.d.ts.map +1 -1
  12. package/dist/types/src/signal/swarm-messenger.d.ts +1 -1
  13. package/dist/types/src/signal/swarm-messenger.d.ts.map +1 -1
  14. package/dist/types/src/swarm/connection-limiter.d.ts +1 -1
  15. package/dist/types/src/swarm/connection-limiter.d.ts.map +1 -1
  16. package/dist/types/src/swarm/connection.d.ts +2 -1
  17. package/dist/types/src/swarm/connection.d.ts.map +1 -1
  18. package/dist/types/src/swarm/peer.d.ts +1 -1
  19. package/dist/types/src/swarm/peer.d.ts.map +1 -1
  20. package/dist/types/src/swarm/swarm.d.ts.map +1 -1
  21. package/dist/types/src/transport/webrtc-transport-proxy.d.ts +1 -1
  22. package/dist/types/src/transport/webrtc-transport-proxy.d.ts.map +1 -1
  23. package/dist/types/src/transport/webrtc-transport.d.ts +3 -3
  24. package/dist/types/src/transport/webrtc-transport.d.ts.map +1 -1
  25. package/package.json +18 -18
  26. package/src/connection-log.ts +2 -0
  27. package/src/signal/swarm-messenger.ts +2 -2
  28. package/src/swarm/connection-limiter.ts +1 -1
  29. package/src/swarm/connection.ts +12 -3
  30. package/src/swarm/peer.ts +8 -6
  31. package/src/swarm/swarm.ts +5 -5
  32. package/src/tests/memory-transport.test.ts +1 -1
  33. package/src/transport/webrtc-transport-proxy.ts +4 -4
  34. package/src/transport/webrtc-transport.ts +20 -6
  35. package/dist/lib/browser/chunk-5TRIVLI6.mjs.map +0 -7
@@ -92,7 +92,7 @@ var Connection = class {
92
92
  initiator: this.initiator
93
93
  }, {
94
94
  F: __dxlog_file,
95
- L: 95,
95
+ L: 96,
96
96
  S: this,
97
97
  C: (f, a) => f(...a)
98
98
  });
@@ -112,7 +112,7 @@ var Connection = class {
112
112
  async openConnection() {
113
113
  invariant(this._state === ConnectionState.INITIAL, "Invalid state.", {
114
114
  F: __dxlog_file,
115
- L: 120,
115
+ L: 121,
116
116
  S: this,
117
117
  A: [
118
118
  "this._state === ConnectionState.INITIAL",
@@ -123,7 +123,7 @@ var Connection = class {
123
123
  id: this._instanceId
124
124
  }), {
125
125
  F: __dxlog_file,
126
- L: 121,
126
+ L: 122,
127
127
  S: this,
128
128
  C: (f, a) => f(...a)
129
129
  });
@@ -135,7 +135,7 @@ var Connection = class {
135
135
  initiator: this.initiator
136
136
  }, {
137
137
  F: __dxlog_file,
138
- L: 122,
138
+ L: 123,
139
139
  S: this,
140
140
  C: (f, a) => f(...a)
141
141
  });
@@ -146,7 +146,7 @@ var Connection = class {
146
146
  this._protocol.stream.on("close", () => {
147
147
  log("protocol stream closed", void 0, {
148
148
  F: __dxlog_file,
149
- L: 139,
149
+ L: 140,
150
150
  S: this,
151
151
  C: (f, a) => f(...a)
152
152
  });
@@ -154,7 +154,7 @@ var Connection = class {
154
154
  });
155
155
  invariant(!this._transport, void 0, {
156
156
  F: __dxlog_file,
157
- L: 143,
157
+ L: 144,
158
158
  S: this,
159
159
  A: [
160
160
  "!this._transport",
@@ -174,6 +174,9 @@ var Connection = class {
174
174
  this.close().catch((err) => this.errors.raise(err));
175
175
  });
176
176
  this._transport.errors.handle((err) => {
177
+ if (!this.closeReason) {
178
+ this.closeReason = err?.message;
179
+ }
177
180
  if (this._state !== ConnectionState.CLOSED && this._state !== ConnectionState.CLOSING) {
178
181
  this.errors.raise(err);
179
182
  }
@@ -186,12 +189,15 @@ var Connection = class {
186
189
  id: this._instanceId
187
190
  }), {
188
191
  F: __dxlog_file,
189
- L: 172,
192
+ L: 176,
190
193
  S: this,
191
194
  C: (f, a) => f(...a)
192
195
  });
193
196
  }
194
- async close() {
197
+ async close(err) {
198
+ if (!this.closeReason) {
199
+ this.closeReason = err?.message;
200
+ }
195
201
  if (this._state === ConnectionState.CLOSED) {
196
202
  return;
197
203
  }
@@ -201,26 +207,26 @@ var Connection = class {
201
207
  peerId: this.ownId
202
208
  }, {
203
209
  F: __dxlog_file,
204
- L: 184,
210
+ L: 191,
205
211
  S: this,
206
212
  C: (f, a) => f(...a)
207
213
  });
208
214
  try {
209
215
  await this._protocol.destroy();
210
- } catch (err) {
211
- log.catch(err, void 0, {
216
+ } catch (err2) {
217
+ log.catch(err2, void 0, {
212
218
  F: __dxlog_file,
213
- L: 190,
219
+ L: 197,
214
220
  S: this,
215
221
  C: (f, a) => f(...a)
216
222
  });
217
223
  }
218
224
  try {
219
225
  await this._transport?.destroy();
220
- } catch (err) {
221
- log.catch(err, void 0, {
226
+ } catch (err2) {
227
+ log.catch(err2, void 0, {
222
228
  F: __dxlog_file,
223
- L: 197,
229
+ L: 204,
224
230
  S: this,
225
231
  C: (f, a) => f(...a)
226
232
  });
@@ -229,7 +235,7 @@ var Connection = class {
229
235
  peerId: this.ownId
230
236
  }, {
231
237
  F: __dxlog_file,
232
- L: 200,
238
+ L: 207,
233
239
  S: this,
234
240
  C: (f, a) => f(...a)
235
241
  });
@@ -244,8 +250,10 @@ var Connection = class {
244
250
  return;
245
251
  }
246
252
  try {
247
- await cancelWithContext(this._ctx, sleep(this._signallingDelay));
248
- this._signallingDelay = Math.min(this._signallingDelay * 2, MAX_SIGNALLING_DELAY);
253
+ if (true) {
254
+ await cancelWithContext(this._ctx, sleep(this._signallingDelay));
255
+ this._signallingDelay = Math.min(this._signallingDelay * 2, MAX_SIGNALLING_DELAY);
256
+ }
249
257
  const signals = [
250
258
  ...this._outgoingSignalBuffer
251
259
  ];
@@ -269,7 +277,7 @@ var Connection = class {
269
277
  err
270
278
  }, {
271
279
  F: __dxlog_file,
272
- L: 234,
280
+ L: 243,
273
281
  S: this,
274
282
  C: (f, a) => f(...a)
275
283
  });
@@ -282,7 +290,7 @@ var Connection = class {
282
290
  async signal(msg) {
283
291
  invariant(msg.sessionId, void 0, {
284
292
  F: __dxlog_file,
285
- L: 243,
293
+ L: 252,
286
294
  S: this,
287
295
  A: [
288
296
  "msg.sessionId",
@@ -292,7 +300,7 @@ var Connection = class {
292
300
  if (!msg.sessionId.equals(this.sessionId)) {
293
301
  log("dropping signal for incorrect session id", void 0, {
294
302
  F: __dxlog_file,
295
- L: 245,
303
+ L: 254,
296
304
  S: this,
297
305
  C: (f, a) => f(...a)
298
306
  });
@@ -300,7 +308,7 @@ var Connection = class {
300
308
  }
301
309
  invariant(msg.data.signal || msg.data.signalBatch, void 0, {
302
310
  F: __dxlog_file,
303
- L: 248,
311
+ L: 257,
304
312
  S: this,
305
313
  A: [
306
314
  "msg.data.signal || msg.data.signalBatch",
@@ -309,7 +317,7 @@ var Connection = class {
309
317
  });
310
318
  invariant(msg.author?.equals(this.remoteId), void 0, {
311
319
  F: __dxlog_file,
312
- L: 249,
320
+ L: 258,
313
321
  S: this,
314
322
  A: [
315
323
  "msg.author?.equals(this.remoteId)",
@@ -318,7 +326,7 @@ var Connection = class {
318
326
  });
319
327
  invariant(msg.recipient?.equals(this.ownId), void 0, {
320
328
  F: __dxlog_file,
321
- L: 250,
329
+ L: 259,
322
330
  S: this,
323
331
  A: [
324
332
  "msg.recipient?.equals(this.ownId)",
@@ -339,7 +347,7 @@ var Connection = class {
339
347
  msg: msg.data
340
348
  }, {
341
349
  F: __dxlog_file,
342
- L: 259,
350
+ L: 268,
343
351
  S: this,
344
352
  C: (f, a) => f(...a)
345
353
  });
@@ -347,7 +355,7 @@ var Connection = class {
347
355
  } else {
348
356
  invariant(this._transport, "Connection not ready to accept signals.", {
349
357
  F: __dxlog_file,
350
- L: 262,
358
+ L: 271,
351
359
  S: this,
352
360
  A: [
353
361
  "this._transport",
@@ -360,7 +368,7 @@ var Connection = class {
360
368
  msg: msg.data
361
369
  }, {
362
370
  F: __dxlog_file,
363
- L: 263,
371
+ L: 272,
364
372
  S: this,
365
373
  C: (f, a) => f(...a)
366
374
  });
@@ -375,13 +383,13 @@ var Connection = class {
375
383
  peerId: this.ownId
376
384
  }, {
377
385
  F: __dxlog_file,
378
- L: 270,
386
+ L: 279,
379
387
  S: this,
380
388
  C: (f, a) => f(...a)
381
389
  });
382
390
  invariant(state !== this._state, "Already in this state.", {
383
391
  F: __dxlog_file,
384
- L: 271,
392
+ L: 280,
385
393
  S: this,
386
394
  A: [
387
395
  "state !== this._state",
@@ -658,6 +666,7 @@ function _ts_decorate2(decorators, target, key, desc) {
658
666
  var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/peer.ts";
659
667
  var CONNECTION_COUNTS_STABLE_AFTER = 5e3;
660
668
  var Peer = class {
669
+ // TODO(burdon): Convert to map?
661
670
  constructor(id, topic, localPeerId, _signalMessaging, _protocolProvider, _transportFactory, _connectionLimiter, _callbacks) {
662
671
  this.id = id;
663
672
  this.topic = topic;
@@ -687,12 +696,12 @@ var Peer = class {
687
696
  sessionId: this.connection?.sessionId
688
697
  }, {
689
698
  F: __dxlog_file3,
690
- L: 106,
699
+ L: 108,
691
700
  S: this,
692
701
  C: (f, a) => f(...a)
693
702
  });
694
703
  if (this.connection) {
695
- await this.closeConnection();
704
+ await this.closeConnection(new Error("Connection displaced by remote initiator."));
696
705
  }
697
706
  } else {
698
707
  return {
@@ -704,7 +713,7 @@ var Peer = class {
704
713
  if (!this.connection) {
705
714
  invariant3(message.sessionId, void 0, {
706
715
  F: __dxlog_file3,
707
- L: 126,
716
+ L: 128,
708
717
  S: this,
709
718
  A: [
710
719
  "message.sessionId",
@@ -724,12 +733,12 @@ var Peer = class {
724
733
  err
725
734
  }, {
726
735
  F: __dxlog_file3,
727
- L: 134,
736
+ L: 136,
728
737
  S: this,
729
738
  C: (f, a) => f(...a)
730
739
  });
731
740
  }
732
- await this.closeConnection();
741
+ await this.closeConnection(err);
733
742
  }
734
743
  return {
735
744
  accept: true
@@ -746,7 +755,7 @@ var Peer = class {
746
755
  async initiateConnection() {
747
756
  invariant3(!this.initiating, "Initiation in progress.", {
748
757
  F: __dxlog_file3,
749
- L: 151,
758
+ L: 153,
750
759
  S: this,
751
760
  A: [
752
761
  "!this.initiating",
@@ -755,7 +764,7 @@ var Peer = class {
755
764
  });
756
765
  invariant3(!this.connection, "Already connected.", {
757
766
  F: __dxlog_file3,
758
- L: 152,
767
+ L: 154,
759
768
  S: this,
760
769
  A: [
761
770
  "!this.connection",
@@ -770,7 +779,7 @@ var Peer = class {
770
779
  sessionId
771
780
  }, {
772
781
  F: __dxlog_file3,
773
- L: 154,
782
+ L: 156,
774
783
  S: this,
775
784
  C: (f, a) => f(...a)
776
785
  });
@@ -794,14 +803,14 @@ var Peer = class {
794
803
  remoteId: this.id
795
804
  }, {
796
805
  F: __dxlog_file3,
797
- L: 169,
806
+ L: 171,
798
807
  S: this,
799
808
  C: (f, a) => f(...a)
800
809
  });
801
810
  if (connection.state !== ConnectionState.INITIAL) {
802
811
  log3("ignoring response", void 0, {
803
812
  F: __dxlog_file3,
804
- L: 171,
813
+ L: 173,
805
814
  S: this,
806
815
  C: (f, a) => f(...a)
807
816
  });
@@ -821,11 +830,11 @@ var Peer = class {
821
830
  remoteId: this.id
822
831
  }, {
823
832
  F: __dxlog_file3,
824
- L: 182,
833
+ L: 184,
825
834
  S: this,
826
835
  C: (f, a) => f(...a)
827
836
  });
828
- await this.closeConnection();
837
+ await this.closeConnection(err);
829
838
  throw err;
830
839
  } finally {
831
840
  this.initiating = false;
@@ -844,13 +853,13 @@ var Peer = class {
844
853
  sessionId
845
854
  }, {
846
855
  F: __dxlog_file3,
847
- L: 196,
856
+ L: 198,
848
857
  S: this,
849
858
  C: (f, a) => f(...a)
850
859
  });
851
860
  invariant3(!this.connection, "Already connected.", {
852
861
  F: __dxlog_file3,
853
- L: 203,
862
+ L: 205,
854
863
  S: this,
855
864
  A: [
856
865
  "!this.connection",
@@ -891,7 +900,7 @@ var Peer = class {
891
900
  initiator
892
901
  }, {
893
902
  F: __dxlog_file3,
894
- L: 229,
903
+ L: 231,
895
904
  S: this,
896
905
  C: (f, a) => f(...a)
897
906
  });
@@ -905,13 +914,13 @@ var Peer = class {
905
914
  initiator
906
915
  }, {
907
916
  F: __dxlog_file3,
908
- L: 240,
917
+ L: 242,
909
918
  S: this,
910
919
  C: (f, a) => f(...a)
911
920
  });
912
921
  invariant3(this.connection === connection, "Connection mismatch (race condition).", {
913
922
  F: __dxlog_file3,
914
- L: 241,
923
+ L: 243,
915
924
  S: this,
916
925
  A: [
917
926
  "this.connection === connection",
@@ -926,7 +935,7 @@ var Peer = class {
926
935
  initiator
927
936
  }, {
928
937
  F: __dxlog_file3,
929
- L: 243,
938
+ L: 245,
930
939
  S: this,
931
940
  C: (f, a) => f(...a)
932
941
  });
@@ -956,7 +965,7 @@ var Peer = class {
956
965
  err
957
966
  }, {
958
967
  F: __dxlog_file3,
959
- L: 277,
968
+ L: 279,
960
969
  S: this,
961
970
  C: (f, a) => f(...a)
962
971
  });
@@ -969,16 +978,16 @@ var Peer = class {
969
978
  err
970
979
  }, {
971
980
  F: __dxlog_file3,
972
- L: 278,
981
+ L: 280,
973
982
  S: this,
974
983
  C: (f, a) => f(...a)
975
984
  });
976
- void this.closeConnection();
985
+ void this.closeConnection(err);
977
986
  });
978
987
  this.connection = connection;
979
988
  return connection;
980
989
  }
981
- async closeConnection() {
990
+ async closeConnection(err) {
982
991
  if (!this.connection) {
983
992
  return;
984
993
  }
@@ -988,17 +997,17 @@ var Peer = class {
988
997
  sessionId: connection.sessionId
989
998
  }, {
990
999
  F: __dxlog_file3,
991
- L: 301,
1000
+ L: 303,
992
1001
  S: this,
993
1002
  C: (f, a) => f(...a)
994
1003
  });
995
- await connection.close();
1004
+ await connection.close(err);
996
1005
  log3("closed", {
997
1006
  peerId: this.id,
998
1007
  sessionId: connection.sessionId
999
1008
  }, {
1000
1009
  F: __dxlog_file3,
1001
- L: 307,
1010
+ L: 309,
1002
1011
  S: this,
1003
1012
  C: (f, a) => f(...a)
1004
1013
  });
@@ -1009,7 +1018,7 @@ var Peer = class {
1009
1018
  message
1010
1019
  }, {
1011
1020
  F: __dxlog_file3,
1012
- L: 312,
1021
+ L: 314,
1013
1022
  S: this,
1014
1023
  C: (f, a) => f(...a)
1015
1024
  });
@@ -1024,7 +1033,7 @@ var Peer = class {
1024
1033
  topic: this.topic
1025
1034
  }, {
1026
1035
  F: __dxlog_file3,
1027
- L: 322,
1036
+ L: 324,
1028
1037
  S: this,
1029
1038
  C: (f, a) => f(...a)
1030
1039
  });
@@ -1073,9 +1082,9 @@ var Swarm = class {
1073
1082
  this._transportFactory = _transportFactory;
1074
1083
  this._label = _label;
1075
1084
  this._connectionLimiter = _connectionLimiter;
1076
- this._peers = new ComplexMap2(PublicKey4.hash);
1077
1085
  this._ctx = new Context4();
1078
1086
  this._listeningHandle = void 0;
1087
+ this._peers = new ComplexMap2(PublicKey4.hash);
1079
1088
  this._instanceId = PublicKey4.random().toHex();
1080
1089
  this.connectionAdded = new Event2();
1081
1090
  this.disconnected = new Event2();
@@ -1605,7 +1614,7 @@ import { PublicKey as PublicKey6 } from "@dxos/keys";
1605
1614
  import { log as log6 } from "@dxos/log";
1606
1615
  import { ComplexMap as ComplexMap4 } from "@dxos/util";
1607
1616
  var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection-limiter.ts";
1608
- var MAX_CONCURRENT_INITIATING_CONNECTIONS = 3;
1617
+ var MAX_CONCURRENT_INITIATING_CONNECTIONS = 10;
1609
1618
  var ConnectionLimiter = class {
1610
1619
  constructor({ maxConcurrentInitConnections = MAX_CONCURRENT_INITIATING_CONNECTIONS } = {}) {
1611
1620
  this._ctx = new Context5();
@@ -1718,6 +1727,7 @@ var ConnectionLog = class {
1718
1727
  swarm.connectionAdded.on((connection) => {
1719
1728
  const connectionInfo = {
1720
1729
  state: ConnectionState.INITIAL,
1730
+ closeReason: connection.closeReason,
1721
1731
  remotePeerId: connection.remoteId,
1722
1732
  sessionId: connection.sessionId,
1723
1733
  transport: connection.transport && Object.getPrototypeOf(connection.transport).constructor.name,
@@ -1728,6 +1738,7 @@ var ConnectionLog = class {
1728
1738
  this.update.emit();
1729
1739
  connection.stateChanged.on((state) => {
1730
1740
  connectionInfo.state = state;
1741
+ connectionInfo.closeReason = connection.closeReason;
1731
1742
  connectionInfo.events.push({
1732
1743
  type: EventType.CONNECTION_STATE_CHANGED,
1733
1744
  newState: state
@@ -2444,34 +2455,39 @@ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-man
2444
2455
  var WebRTCTransport = class {
2445
2456
  constructor(params) {
2446
2457
  this.params = params;
2458
+ this._instanceId = PublicKey10.random().toHex();
2447
2459
  this._closed = false;
2448
2460
  this.closed = new Event7();
2449
2461
  this.connected = new Event7();
2450
2462
  this.errors = new ErrorStream4();
2451
- this._instanceId = PublicKey10.random().toHex();
2452
2463
  log11.trace("dxos.mesh.webrtc-transport.constructor", trace4.begin({
2453
2464
  id: this._instanceId
2454
2465
  }), {
2455
2466
  F: __dxlog_file12,
2456
- L: 39,
2467
+ L: 44,
2457
2468
  S: this,
2458
2469
  C: (f, a) => f(...a)
2459
2470
  });
2460
2471
  log11("created connection", params, {
2461
2472
  F: __dxlog_file12,
2462
- L: 40,
2473
+ L: 45,
2463
2474
  S: this,
2464
2475
  C: (f, a) => f(...a)
2465
2476
  });
2466
2477
  this._peer = new SimplePeerConstructor({
2467
2478
  initiator: this.params.initiator,
2468
- wrtc: SimplePeerConstructor.WEBRTC_SUPPORT ? void 0 : wrtc ?? raise2(new Error("wrtc not available")),
2469
- config: this.params.webrtcConfig
2479
+ config: this.params.webrtcConfig,
2480
+ // https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createDataChannel
2481
+ channelConfig: {
2482
+ protocol: "dxos.mesh"
2483
+ },
2484
+ // Custom WebRTC implementation (for Node); otherwise get-browser-rtc.
2485
+ wrtc: SimplePeerConstructor.WEBRTC_SUPPORT ? void 0 : wrtc ?? raise2(new Error("wrtc not available"))
2470
2486
  });
2471
2487
  this._peer.on("signal", async (data) => {
2472
2488
  log11("signal", data, {
2473
2489
  F: __dxlog_file12,
2474
- L: 48,
2490
+ L: 62,
2475
2491
  S: this,
2476
2492
  C: (f, a) => f(...a)
2477
2493
  });
@@ -2484,7 +2500,7 @@ var WebRTCTransport = class {
2484
2500
  this._peer.on("connect", () => {
2485
2501
  log11("connected", void 0, {
2486
2502
  F: __dxlog_file12,
2487
- L: 53,
2503
+ L: 67,
2488
2504
  S: this,
2489
2505
  C: (f, a) => f(...a)
2490
2506
  });
@@ -2494,7 +2510,7 @@ var WebRTCTransport = class {
2494
2510
  this._peer.on("close", async () => {
2495
2511
  log11("closed", void 0, {
2496
2512
  F: __dxlog_file12,
2497
- L: 59,
2513
+ L: 73,
2498
2514
  S: this,
2499
2515
  C: (f, a) => f(...a)
2500
2516
  });
@@ -2511,7 +2527,7 @@ var WebRTCTransport = class {
2511
2527
  stats
2512
2528
  }, {
2513
2529
  F: __dxlog_file12,
2514
- L: 71,
2530
+ L: 85,
2515
2531
  S: this,
2516
2532
  C: (f, a) => f(...a)
2517
2533
  });
@@ -2525,7 +2541,7 @@ var WebRTCTransport = class {
2525
2541
  id: this._instanceId
2526
2542
  }), {
2527
2543
  F: __dxlog_file12,
2528
- L: 81,
2544
+ L: 95,
2529
2545
  S: this,
2530
2546
  C: (f, a) => f(...a)
2531
2547
  });
@@ -2533,7 +2549,7 @@ var WebRTCTransport = class {
2533
2549
  async destroy() {
2534
2550
  log11("closing...", void 0, {
2535
2551
  F: __dxlog_file12,
2536
- L: 85,
2552
+ L: 99,
2537
2553
  S: this,
2538
2554
  C: (f, a) => f(...a)
2539
2555
  });
@@ -2543,7 +2559,7 @@ var WebRTCTransport = class {
2543
2559
  this.closed.emit();
2544
2560
  log11("closed", void 0, {
2545
2561
  F: __dxlog_file12,
2546
- L: 90,
2562
+ L: 104,
2547
2563
  S: this,
2548
2564
  C: (f, a) => f(...a)
2549
2565
  });
@@ -2554,7 +2570,7 @@ var WebRTCTransport = class {
2554
2570
  }
2555
2571
  invariant11(signal.payload.data, "Signal message must contain signal data.", {
2556
2572
  F: __dxlog_file12,
2557
- L: 98,
2573
+ L: 112,
2558
2574
  S: this,
2559
2575
  A: [
2560
2576
  "signal.payload.data",
@@ -2722,9 +2738,9 @@ var WebRTCTransportProxy = class {
2722
2738
  this._proxyId = PublicKey12.random();
2723
2739
  this._ctx = new Context6();
2724
2740
  this.closed = new Event8();
2725
- this._closed = false;
2726
2741
  this.connected = new Event8();
2727
2742
  this.errors = new ErrorStream5();
2743
+ this._closed = false;
2728
2744
  this._serviceStream = this._params.bridgeService.open({
2729
2745
  proxyId: this._proxyId,
2730
2746
  initiator: this._params.initiator
@@ -2800,7 +2816,7 @@ var WebRTCTransportProxy = class {
2800
2816
  if (this._closed) {
2801
2817
  return;
2802
2818
  }
2803
- this._serviceStream.close();
2819
+ await this._serviceStream.close();
2804
2820
  try {
2805
2821
  await this._params.bridgeService.close({
2806
2822
  proxyId: this._proxyId
@@ -2821,7 +2837,7 @@ var WebRTCTransportProxy = class {
2821
2837
  */
2822
2838
  // TODO(burdon): Option on close method.
2823
2839
  forceClose() {
2824
- this._serviceStream.close();
2840
+ void this._serviceStream.close();
2825
2841
  this.closed.emit();
2826
2842
  this._closed = true;
2827
2843
  }
@@ -2902,4 +2918,4 @@ export {
2902
2918
  WebRTCTransportProxyFactory,
2903
2919
  createTeleportProtocolFactory
2904
2920
  };
2905
- //# sourceMappingURL=chunk-5TRIVLI6.mjs.map
2921
+ //# sourceMappingURL=chunk-WQ3YXGWP.mjs.map