@dxos/network-manager 0.1.48-next.83f55fd → 0.1.48

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.
@@ -114,15 +114,29 @@ var Connection = class {
114
114
  this._transport = this._transportFactory.createTransport({
115
115
  initiator: this.initiator,
116
116
  stream: this._protocol.stream,
117
- sendSignal: async (signal) => this._signalMessaging.signal({
118
- author: this.ownId,
119
- recipient: this.remoteId,
120
- sessionId: this.sessionId,
121
- topic: this.topic,
122
- data: {
123
- signal
117
+ sendSignal: async (signal) => {
118
+ try {
119
+ await this._signalMessaging.signal({
120
+ author: this.ownId,
121
+ recipient: this.remoteId,
122
+ sessionId: this.sessionId,
123
+ topic: this.topic,
124
+ data: {
125
+ signal
126
+ }
127
+ });
128
+ } catch (err) {
129
+ log("Signal failed", {
130
+ err
131
+ }, {
132
+ file: "connection.ts",
133
+ line: 122,
134
+ scope: this,
135
+ callSite: (f, a) => f(...a)
136
+ });
137
+ await this.close();
124
138
  }
125
- })
139
+ }
126
140
  });
127
141
  this._transport.connected.once(() => {
128
142
  this._changeState(ConnectionState.CONNECTED);
@@ -144,7 +158,7 @@ var Connection = class {
144
158
  id: this._instanceId
145
159
  }), {
146
160
  file: "connection.ts",
147
- line: 143,
161
+ line: 150,
148
162
  scope: this,
149
163
  callSite: (f, a) => f(...a)
150
164
  });
@@ -159,7 +173,7 @@ var Connection = class {
159
173
  peerId: this.ownId
160
174
  }, {
161
175
  file: "connection.ts",
162
- line: 153,
176
+ line: 160,
163
177
  scope: this,
164
178
  callSite: (f, a) => f(...a)
165
179
  });
@@ -168,7 +182,7 @@ var Connection = class {
168
182
  } catch (err) {
169
183
  log.catch(err, {}, {
170
184
  file: "connection.ts",
171
- line: 159,
185
+ line: 166,
172
186
  scope: this,
173
187
  callSite: (f, a) => f(...a)
174
188
  });
@@ -178,7 +192,7 @@ var Connection = class {
178
192
  } catch (err1) {
179
193
  log.catch(err1, {}, {
180
194
  file: "connection.ts",
181
- line: 166,
195
+ line: 173,
182
196
  scope: this,
183
197
  callSite: (f, a) => f(...a)
184
198
  });
@@ -187,7 +201,7 @@ var Connection = class {
187
201
  peerId: this.ownId
188
202
  }, {
189
203
  file: "connection.ts",
190
- line: 169,
204
+ line: 176,
191
205
  scope: this,
192
206
  callSite: (f, a) => f(...a)
193
207
  });
@@ -199,7 +213,7 @@ var Connection = class {
199
213
  if (!msg.sessionId.equals(this.sessionId)) {
200
214
  log("dropping signal for incorrect session id", {}, {
201
215
  file: "connection.ts",
202
- line: 176,
216
+ line: 183,
203
217
  scope: this,
204
218
  callSite: (f, a) => f(...a)
205
219
  });
@@ -215,7 +229,7 @@ var Connection = class {
215
229
  msg: msg.data
216
230
  }, {
217
231
  file: "connection.ts",
218
- line: 184,
232
+ line: 191,
219
233
  scope: this,
220
234
  callSite: (f, a) => f(...a)
221
235
  });
@@ -229,7 +243,7 @@ var Connection = class {
229
243
  msg: msg.data
230
244
  }, {
231
245
  file: "connection.ts",
232
- line: 190,
246
+ line: 197,
233
247
  scope: this,
234
248
  callSite: (f, a) => f(...a)
235
249
  });
@@ -242,7 +256,7 @@ var Connection = class {
242
256
  peerId: this.ownId
243
257
  }, {
244
258
  file: "connection.ts",
245
- line: 195,
259
+ line: 202,
246
260
  scope: this,
247
261
  callSite: (f, a) => f(...a)
248
262
  });
@@ -309,16 +323,11 @@ var SwarmMessenger = class {
309
323
  async signal(message) {
310
324
  var _a;
311
325
  assert2((_a = message.data) == null ? void 0 : _a.signal);
312
- return this._sendReliableMessage({
326
+ await this._sendReliableMessage({
313
327
  author: message.author,
314
328
  recipient: message.recipient,
315
329
  message
316
- }).catch((err) => log2.catch(err, {}, {
317
- file: "swarm-messenger.ts",
318
- line: 85,
319
- scope: this,
320
- callSite: (f, a) => f(...a)
321
- }));
330
+ });
322
331
  }
323
332
  async offer(message) {
324
333
  const networkMessage = {
@@ -353,7 +362,7 @@ var SwarmMessenger = class {
353
362
  scope: this,
354
363
  callSite: (f, a) => f(...a)
355
364
  });
356
- return this._sendMessage({
365
+ await this._sendMessage({
357
366
  author,
358
367
  recipient,
359
368
  payload: {
@@ -402,12 +411,7 @@ var SwarmMessenger = class {
402
411
  answer
403
412
  }
404
413
  }
405
- }).catch((err) => log2.catch(err, {}, {
406
- file: "swarm-messenger.ts",
407
- line: 166,
408
- scope: this,
409
- callSite: (f, a) => f(...a)
410
- }));
414
+ });
411
415
  }
412
416
  async _handleSignal({ author, recipient, message }) {
413
417
  assert2(message.messageId);
@@ -819,10 +823,19 @@ var Swarm = class {
819
823
  this._messenger.listen({
820
824
  peerId: this._ownPeerId,
821
825
  payloadType: "dxos.mesh.swarm.SwarmMessage",
822
- onMessage: async (message) => await this._swarmMessenger.receiveMessage(message)
826
+ onMessage: async (message) => {
827
+ await this._swarmMessenger.receiveMessage(message).catch((err) => log4("Error while receiving message", {
828
+ err
829
+ }, {
830
+ file: "swarm.ts",
831
+ line: 105,
832
+ scope: this,
833
+ callSite: (f, a) => f(...a)
834
+ }));
835
+ }
823
836
  }).catch((error) => log4.catch(error, {}, {
824
837
  file: "swarm.ts",
825
- line: 104,
838
+ line: 108,
826
839
  scope: this,
827
840
  callSite: (f, a) => f(...a)
828
841
  }));
@@ -830,7 +843,7 @@ var Swarm = class {
830
843
  id: this._instanceId
831
844
  }), {
832
845
  file: "swarm.ts",
833
- line: 106,
846
+ line: 110,
834
847
  scope: this,
835
848
  callSite: (f, a) => f(...a)
836
849
  });
@@ -854,7 +867,7 @@ var Swarm = class {
854
867
  async destroy() {
855
868
  log4("destroying...", {}, {
856
869
  file: "swarm.ts",
857
- line: 134,
870
+ line: 138,
858
871
  scope: this,
859
872
  callSite: (f, a) => f(...a)
860
873
  });
@@ -863,7 +876,7 @@ var Swarm = class {
863
876
  await Promise.all(Array.from(this._peers.keys()).map((key) => this._destroyPeer(key)));
864
877
  log4("destroyed", {}, {
865
878
  file: "swarm.ts",
866
- line: 138,
879
+ line: 142,
867
880
  scope: this,
868
881
  callSite: (f, a) => f(...a)
869
882
  });
@@ -878,7 +891,7 @@ var Swarm = class {
878
891
  topology: getClassName(topology)
879
892
  }, {
880
893
  file: "swarm.ts",
881
- line: 146,
894
+ line: 150,
882
895
  scope: this,
883
896
  callSite: (f, a) => f(...a)
884
897
  });
@@ -893,14 +906,14 @@ var Swarm = class {
893
906
  swarmEvent
894
907
  }, {
895
908
  file: "swarm.ts",
896
- line: 159,
909
+ line: 163,
897
910
  scope: this,
898
911
  callSite: (f, a) => f(...a)
899
912
  });
900
913
  if (this._ctx.disposed) {
901
914
  log4("swarm event ignored for disposed swarm", {}, {
902
915
  file: "swarm.ts",
903
- line: 162,
916
+ line: 166,
904
917
  scope: this,
905
918
  callSite: (f, a) => f(...a)
906
919
  });
@@ -912,7 +925,7 @@ var Swarm = class {
912
925
  peerId
913
926
  }, {
914
927
  file: "swarm.ts",
915
- line: 168,
928
+ line: 172,
916
929
  scope: this,
917
930
  callSite: (f, a) => f(...a)
918
931
  });
@@ -927,7 +940,7 @@ var Swarm = class {
927
940
  if (((_a = peer1.connection) == null ? void 0 : _a.state) !== ConnectionState.CONNECTED) {
928
941
  void this._destroyPeer(peer1.id).catch((err) => log4.catch(err, {}, {
929
942
  file: "swarm.ts",
930
- line: 179,
943
+ line: 183,
931
944
  scope: this,
932
945
  callSite: (f, a) => f(...a)
933
946
  }));
@@ -942,14 +955,14 @@ var Swarm = class {
942
955
  message
943
956
  }, {
944
957
  file: "swarm.ts",
945
- line: 189,
958
+ line: 193,
946
959
  scope: this,
947
960
  callSite: (f, a) => f(...a)
948
961
  });
949
962
  if (this._ctx.disposed) {
950
963
  log4("ignored for disposed swarm", {}, {
951
964
  file: "swarm.ts",
952
- line: 191,
965
+ line: 195,
953
966
  scope: this,
954
967
  callSite: (f, a) => f(...a)
955
968
  });
@@ -963,7 +976,7 @@ var Swarm = class {
963
976
  message
964
977
  }, {
965
978
  file: "swarm.ts",
966
- line: 198,
979
+ line: 202,
967
980
  scope: this,
968
981
  callSite: (f, a) => f(...a)
969
982
  });
@@ -976,7 +989,7 @@ var Swarm = class {
976
989
  message
977
990
  }, {
978
991
  file: "swarm.ts",
979
- line: 202,
992
+ line: 206,
980
993
  scope: this,
981
994
  callSite: (f, a) => f(...a)
982
995
  });
@@ -995,14 +1008,14 @@ var Swarm = class {
995
1008
  message
996
1009
  }, {
997
1010
  file: "swarm.ts",
998
- line: 214,
1011
+ line: 218,
999
1012
  scope: this,
1000
1013
  callSite: (f, a) => f(...a)
1001
1014
  });
1002
1015
  if (this._ctx.disposed) {
1003
1016
  log4.info("ignored for offline swarm", {}, {
1004
1017
  file: "swarm.ts",
1005
- line: 216,
1018
+ line: 220,
1006
1019
  scope: this,
1007
1020
  callSite: (f, a) => f(...a)
1008
1021
  });
@@ -1083,7 +1096,7 @@ var Swarm = class {
1083
1096
  } catch (err) {
1084
1097
  log4("initiation error", err, {
1085
1098
  file: "swarm.ts",
1086
- line: 319,
1099
+ line: 323,
1087
1100
  scope: this,
1088
1101
  callSite: (f, a) => f(...a)
1089
1102
  });
@@ -1111,7 +1124,7 @@ var Swarm = class {
1111
1124
  remoteId
1112
1125
  }, {
1113
1126
  file: "swarm.ts",
1114
- line: 346,
1127
+ line: 350,
1115
1128
  scope: this,
1116
1129
  callSite: (f, a) => f(...a)
1117
1130
  });
@@ -1128,7 +1141,7 @@ var Swarm = class {
1128
1141
  remoteId
1129
1142
  }, {
1130
1143
  file: "swarm.ts",
1131
- line: 360,
1144
+ line: 364,
1132
1145
  scope: this,
1133
1146
  callSite: (f, a) => f(...a)
1134
1147
  });
@@ -1138,7 +1151,7 @@ var Swarm = class {
1138
1151
  remoteId
1139
1152
  }, {
1140
1153
  file: "swarm.ts",
1141
- line: 363,
1154
+ line: 367,
1142
1155
  scope: this,
1143
1156
  callSite: (f, a) => f(...a)
1144
1157
  });
@@ -2296,4 +2309,4 @@ export {
2296
2309
  WebRTCTransportProxyFactory,
2297
2310
  createTeleportProtocolFactory
2298
2311
  };
2299
- //# sourceMappingURL=chunk-CVPTBFWI.mjs.map
2312
+ //# sourceMappingURL=chunk-6HMQOZ2C.mjs.map