@dxos/network-manager 0.1.57 → 0.1.58-main.03af36b
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-UKMTAO4L.mjs → chunk-PSWNMALH.mjs} +195 -108
- package/dist/lib/browser/chunk-PSWNMALH.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 +155 -22
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node/index.cjs +192 -105
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +345 -125
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/types/src/swarm/connection.d.ts +3 -1
- package/dist/types/src/swarm/connection.d.ts.map +1 -1
- package/dist/types/src/swarm/peer.d.ts.map +1 -1
- package/dist/types/src/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/tests/tcp-transport.test.d.ts +2 -0
- package/dist/types/src/tests/tcp-transport.test.d.ts.map +1 -0
- package/dist/types/src/transport/simplepeer-transport-proxy.d.ts.map +1 -1
- package/dist/types/src/transport/simplepeer-transport.d.ts.map +1 -1
- package/dist/types/src/transport/tcp-transport.d.ts +23 -0
- package/dist/types/src/transport/tcp-transport.d.ts.map +1 -0
- package/dist/types/src/transport/transport.d.ts +2 -1
- package/dist/types/src/transport/transport.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/swarm/connection.ts +52 -26
- package/src/swarm/peer.ts +4 -1
- package/src/testing/test-builder.ts +5 -1
- package/src/tests/tcp-transport.test.ts +67 -0
- package/src/transport/simplepeer-transport-proxy.ts +28 -2
- package/src/transport/simplepeer-transport.ts +39 -2
- package/src/transport/tcp-transport.ts +107 -0
- package/src/transport/transport.ts +1 -0
- package/dist/lib/browser/chunk-UKMTAO4L.mjs.map +0 -7
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import { DeferredTask, Event, sleep, synchronized } from "@dxos/async";
|
|
8
8
|
import { Context, cancelWithContext } from "@dxos/context";
|
|
9
9
|
import { ErrorStream } from "@dxos/debug";
|
|
10
|
-
import { CancelledError } from "@dxos/errors";
|
|
10
|
+
import { CancelledError, ProtocolError, ConnectionResetError, ConnectivityError, UnknownProtocolError } from "@dxos/errors";
|
|
11
11
|
import { invariant } from "@dxos/invariant";
|
|
12
12
|
import { PublicKey } from "@dxos/keys";
|
|
13
13
|
import { log } from "@dxos/log";
|
|
@@ -22,7 +22,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
22
22
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
23
23
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
24
24
|
}
|
|
25
|
-
var __dxlog_file = "/
|
|
25
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection.ts";
|
|
26
26
|
var STARTING_SIGNALLING_DELAY = 10;
|
|
27
27
|
var MAX_SIGNALLING_DELAY = 300;
|
|
28
28
|
var ConnectionState;
|
|
@@ -64,6 +64,8 @@ var ConnectionState;
|
|
|
64
64
|
*/
|
|
65
65
|
"CLOSED"
|
|
66
66
|
] = "CLOSED";
|
|
67
|
+
ConnectionState5["ABORTING"] = "ABORTING";
|
|
68
|
+
ConnectionState5["ABORTED"] = "ABORTED";
|
|
67
69
|
})(ConnectionState || (ConnectionState = {}));
|
|
68
70
|
var Connection = class {
|
|
69
71
|
constructor(topic, ownId, remoteId, sessionId, initiator, _signalMessaging, _protocol, _transportFactory, _callbacks) {
|
|
@@ -95,7 +97,7 @@ var Connection = class {
|
|
|
95
97
|
initiator: this.initiator
|
|
96
98
|
}, {
|
|
97
99
|
F: __dxlog_file,
|
|
98
|
-
L:
|
|
100
|
+
L: 123,
|
|
99
101
|
S: this,
|
|
100
102
|
C: (f, a) => f(...a)
|
|
101
103
|
});
|
|
@@ -115,7 +117,7 @@ var Connection = class {
|
|
|
115
117
|
async openConnection() {
|
|
116
118
|
invariant(this._state === ConnectionState.INITIAL, "Invalid state.", {
|
|
117
119
|
F: __dxlog_file,
|
|
118
|
-
L:
|
|
120
|
+
L: 148,
|
|
119
121
|
S: this,
|
|
120
122
|
A: [
|
|
121
123
|
"this._state === ConnectionState.INITIAL",
|
|
@@ -126,7 +128,7 @@ var Connection = class {
|
|
|
126
128
|
id: this._instanceId
|
|
127
129
|
}), {
|
|
128
130
|
F: __dxlog_file,
|
|
129
|
-
L:
|
|
131
|
+
L: 149,
|
|
130
132
|
S: this,
|
|
131
133
|
C: (f, a) => f(...a)
|
|
132
134
|
});
|
|
@@ -138,7 +140,7 @@ var Connection = class {
|
|
|
138
140
|
initiator: this.initiator
|
|
139
141
|
}, {
|
|
140
142
|
F: __dxlog_file,
|
|
141
|
-
L:
|
|
143
|
+
L: 150,
|
|
142
144
|
S: this,
|
|
143
145
|
C: (f, a) => f(...a)
|
|
144
146
|
});
|
|
@@ -149,15 +151,15 @@ var Connection = class {
|
|
|
149
151
|
this._protocol.stream.on("close", () => {
|
|
150
152
|
log("protocol stream closed", void 0, {
|
|
151
153
|
F: __dxlog_file,
|
|
152
|
-
L:
|
|
154
|
+
L: 167,
|
|
153
155
|
S: this,
|
|
154
156
|
C: (f, a) => f(...a)
|
|
155
157
|
});
|
|
156
|
-
this.close().catch((err) => this.errors.raise(err));
|
|
158
|
+
this.close(new ProtocolError("protocol stream closed")).catch((err) => this.errors.raise(err));
|
|
157
159
|
});
|
|
158
160
|
invariant(!this._transport, void 0, {
|
|
159
161
|
F: __dxlog_file,
|
|
160
|
-
L:
|
|
162
|
+
L: 171,
|
|
161
163
|
S: this,
|
|
162
164
|
A: [
|
|
163
165
|
"!this._transport",
|
|
@@ -177,7 +179,7 @@ var Connection = class {
|
|
|
177
179
|
this._transport = void 0;
|
|
178
180
|
log("abort triggered by transport close", void 0, {
|
|
179
181
|
F: __dxlog_file,
|
|
180
|
-
L:
|
|
182
|
+
L: 185,
|
|
181
183
|
S: this,
|
|
182
184
|
C: (f, a) => f(...a)
|
|
183
185
|
});
|
|
@@ -188,21 +190,38 @@ var Connection = class {
|
|
|
188
190
|
err
|
|
189
191
|
}, {
|
|
190
192
|
F: __dxlog_file,
|
|
191
|
-
L:
|
|
193
|
+
L: 190,
|
|
192
194
|
S: this,
|
|
193
195
|
C: (f, a) => f(...a)
|
|
194
196
|
});
|
|
195
197
|
if (!this.closeReason) {
|
|
196
198
|
this.closeReason = err?.message;
|
|
197
199
|
}
|
|
198
|
-
if (err
|
|
199
|
-
log("aborting due to transport
|
|
200
|
+
if (err instanceof ConnectionResetError) {
|
|
201
|
+
log("aborting due to transport ConnectionResetError", void 0, {
|
|
200
202
|
F: __dxlog_file,
|
|
201
|
-
L:
|
|
203
|
+
L: 197,
|
|
202
204
|
S: this,
|
|
203
205
|
C: (f, a) => f(...a)
|
|
204
206
|
});
|
|
205
207
|
this.abort().catch((err2) => this.errors.raise(err2));
|
|
208
|
+
} else if (err instanceof ConnectivityError) {
|
|
209
|
+
log("aborting due to transport ConnectivityError", void 0, {
|
|
210
|
+
F: __dxlog_file,
|
|
211
|
+
L: 200,
|
|
212
|
+
S: this,
|
|
213
|
+
C: (f, a) => f(...a)
|
|
214
|
+
});
|
|
215
|
+
this.abort().catch((err2) => this.errors.raise(err2));
|
|
216
|
+
} else if (err instanceof UnknownProtocolError) {
|
|
217
|
+
log("unsure what to do for UnknownProtocolError", {
|
|
218
|
+
err
|
|
219
|
+
}, {
|
|
220
|
+
F: __dxlog_file,
|
|
221
|
+
L: 203,
|
|
222
|
+
S: this,
|
|
223
|
+
C: (f, a) => f(...a)
|
|
224
|
+
});
|
|
206
225
|
}
|
|
207
226
|
if (this._state !== ConnectionState.CLOSED && this._state !== ConnectionState.CLOSING) {
|
|
208
227
|
this.errors.raise(err);
|
|
@@ -216,7 +235,7 @@ var Connection = class {
|
|
|
216
235
|
id: this._instanceId
|
|
217
236
|
}), {
|
|
218
237
|
F: __dxlog_file,
|
|
219
|
-
L:
|
|
238
|
+
L: 218,
|
|
220
239
|
S: this,
|
|
221
240
|
C: (f, a) => f(...a)
|
|
222
241
|
});
|
|
@@ -226,30 +245,30 @@ var Connection = class {
|
|
|
226
245
|
err
|
|
227
246
|
}, {
|
|
228
247
|
F: __dxlog_file,
|
|
229
|
-
L:
|
|
248
|
+
L: 224,
|
|
230
249
|
S: this,
|
|
231
250
|
C: (f, a) => f(...a)
|
|
232
251
|
});
|
|
233
|
-
if (
|
|
234
|
-
this.closeReason
|
|
235
|
-
}
|
|
236
|
-
if (this._state === ConnectionState.CLOSED) {
|
|
237
|
-
log("abort ignored: already closed", this.closeReason, {
|
|
252
|
+
if (this._state === ConnectionState.CLOSED || this._state === ConnectionState.ABORTED) {
|
|
253
|
+
log(`abort ignored: already ${this._state}`, this.closeReason, {
|
|
238
254
|
F: __dxlog_file,
|
|
239
|
-
L:
|
|
255
|
+
L: 226,
|
|
240
256
|
S: this,
|
|
241
257
|
C: (f, a) => f(...a)
|
|
242
258
|
});
|
|
243
259
|
return;
|
|
244
260
|
}
|
|
245
|
-
this._changeState(ConnectionState.
|
|
261
|
+
this._changeState(ConnectionState.ABORTING);
|
|
262
|
+
if (!this.closeReason) {
|
|
263
|
+
this.closeReason = err?.message;
|
|
264
|
+
}
|
|
246
265
|
await this._ctx.dispose();
|
|
247
266
|
try {
|
|
248
267
|
log("aborting protocol... ", {
|
|
249
268
|
proto: this._protocol
|
|
250
269
|
}, {
|
|
251
270
|
F: __dxlog_file,
|
|
252
|
-
L:
|
|
271
|
+
L: 239,
|
|
253
272
|
S: this,
|
|
254
273
|
C: (f, a) => f(...a)
|
|
255
274
|
});
|
|
@@ -257,7 +276,7 @@ var Connection = class {
|
|
|
257
276
|
} catch (err2) {
|
|
258
277
|
log.catch(err2, void 0, {
|
|
259
278
|
F: __dxlog_file,
|
|
260
|
-
L:
|
|
279
|
+
L: 242,
|
|
261
280
|
S: this,
|
|
262
281
|
C: (f, a) => f(...a)
|
|
263
282
|
});
|
|
@@ -267,56 +286,68 @@ var Connection = class {
|
|
|
267
286
|
} catch (err2) {
|
|
268
287
|
log.catch(err2, void 0, {
|
|
269
288
|
F: __dxlog_file,
|
|
270
|
-
L:
|
|
289
|
+
L: 249,
|
|
271
290
|
S: this,
|
|
272
291
|
C: (f, a) => f(...a)
|
|
273
292
|
});
|
|
274
293
|
}
|
|
275
|
-
|
|
276
|
-
|
|
294
|
+
try {
|
|
295
|
+
this._callbacks?.onClosed?.(err);
|
|
296
|
+
} catch (err2) {
|
|
297
|
+
log.catch(err2, void 0, {
|
|
298
|
+
F: __dxlog_file,
|
|
299
|
+
L: 255,
|
|
300
|
+
S: this,
|
|
301
|
+
C: (f, a) => f(...a)
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
this._changeState(ConnectionState.ABORTED);
|
|
277
305
|
}
|
|
278
306
|
async close(err) {
|
|
279
307
|
if (!this.closeReason) {
|
|
280
308
|
this.closeReason = err?.message;
|
|
281
309
|
}
|
|
282
|
-
if (this._state === ConnectionState.CLOSED) {
|
|
310
|
+
if (this._state === ConnectionState.CLOSED || this._state === ConnectionState.ABORTING || this._state === ConnectionState.ABORTED) {
|
|
283
311
|
return;
|
|
284
312
|
}
|
|
313
|
+
const lastState = this._state;
|
|
285
314
|
this._changeState(ConnectionState.CLOSING);
|
|
286
315
|
await this._ctx.dispose();
|
|
287
316
|
log("closing...", {
|
|
288
317
|
peerId: this.ownId
|
|
289
318
|
}, {
|
|
290
319
|
F: __dxlog_file,
|
|
291
|
-
L:
|
|
320
|
+
L: 277,
|
|
292
321
|
S: this,
|
|
293
322
|
C: (f, a) => f(...a)
|
|
294
323
|
});
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
324
|
+
if (lastState === ConnectionState.CONNECTED) {
|
|
325
|
+
try {
|
|
326
|
+
await this._protocol.close();
|
|
327
|
+
} catch (err2) {
|
|
328
|
+
log.catch(err2, void 0, {
|
|
329
|
+
F: __dxlog_file,
|
|
330
|
+
L: 284,
|
|
331
|
+
S: this,
|
|
332
|
+
C: (f, a) => f(...a)
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
try {
|
|
336
|
+
await this._transport?.destroy();
|
|
337
|
+
} catch (err2) {
|
|
338
|
+
log.catch(err2, void 0, {
|
|
339
|
+
F: __dxlog_file,
|
|
340
|
+
L: 291,
|
|
341
|
+
S: this,
|
|
342
|
+
C: (f, a) => f(...a)
|
|
343
|
+
});
|
|
344
|
+
}
|
|
314
345
|
}
|
|
315
346
|
log("closed", {
|
|
316
347
|
peerId: this.ownId
|
|
317
348
|
}, {
|
|
318
349
|
F: __dxlog_file,
|
|
319
|
-
L:
|
|
350
|
+
L: 295,
|
|
320
351
|
S: this,
|
|
321
352
|
C: (f, a) => f(...a)
|
|
322
353
|
});
|
|
@@ -359,7 +390,7 @@ var Connection = class {
|
|
|
359
390
|
err
|
|
360
391
|
}, {
|
|
361
392
|
F: __dxlog_file,
|
|
362
|
-
L:
|
|
393
|
+
L: 332,
|
|
363
394
|
S: this,
|
|
364
395
|
C: (f, a) => f(...a)
|
|
365
396
|
});
|
|
@@ -372,7 +403,7 @@ var Connection = class {
|
|
|
372
403
|
async signal(msg) {
|
|
373
404
|
invariant(msg.sessionId, void 0, {
|
|
374
405
|
F: __dxlog_file,
|
|
375
|
-
L:
|
|
406
|
+
L: 341,
|
|
376
407
|
S: this,
|
|
377
408
|
A: [
|
|
378
409
|
"msg.sessionId",
|
|
@@ -382,7 +413,7 @@ var Connection = class {
|
|
|
382
413
|
if (!msg.sessionId.equals(this.sessionId)) {
|
|
383
414
|
log("dropping signal for incorrect session id", void 0, {
|
|
384
415
|
F: __dxlog_file,
|
|
385
|
-
L:
|
|
416
|
+
L: 343,
|
|
386
417
|
S: this,
|
|
387
418
|
C: (f, a) => f(...a)
|
|
388
419
|
});
|
|
@@ -390,7 +421,7 @@ var Connection = class {
|
|
|
390
421
|
}
|
|
391
422
|
invariant(msg.data.signal || msg.data.signalBatch, void 0, {
|
|
392
423
|
F: __dxlog_file,
|
|
393
|
-
L:
|
|
424
|
+
L: 346,
|
|
394
425
|
S: this,
|
|
395
426
|
A: [
|
|
396
427
|
"msg.data.signal || msg.data.signalBatch",
|
|
@@ -399,7 +430,7 @@ var Connection = class {
|
|
|
399
430
|
});
|
|
400
431
|
invariant(msg.author?.equals(this.remoteId), void 0, {
|
|
401
432
|
F: __dxlog_file,
|
|
402
|
-
L:
|
|
433
|
+
L: 347,
|
|
403
434
|
S: this,
|
|
404
435
|
A: [
|
|
405
436
|
"msg.author?.equals(this.remoteId)",
|
|
@@ -408,7 +439,7 @@ var Connection = class {
|
|
|
408
439
|
});
|
|
409
440
|
invariant(msg.recipient?.equals(this.ownId), void 0, {
|
|
410
441
|
F: __dxlog_file,
|
|
411
|
-
L:
|
|
442
|
+
L: 348,
|
|
412
443
|
S: this,
|
|
413
444
|
A: [
|
|
414
445
|
"msg.recipient?.equals(this.ownId)",
|
|
@@ -432,7 +463,7 @@ var Connection = class {
|
|
|
432
463
|
msg: msg.data
|
|
433
464
|
}, {
|
|
434
465
|
F: __dxlog_file,
|
|
435
|
-
L:
|
|
466
|
+
L: 357,
|
|
436
467
|
S: this,
|
|
437
468
|
C: (f, a) => f(...a)
|
|
438
469
|
});
|
|
@@ -440,7 +471,7 @@ var Connection = class {
|
|
|
440
471
|
} else {
|
|
441
472
|
invariant(this._transport, "Connection not ready to accept signals.", {
|
|
442
473
|
F: __dxlog_file,
|
|
443
|
-
L:
|
|
474
|
+
L: 360,
|
|
444
475
|
S: this,
|
|
445
476
|
A: [
|
|
446
477
|
"this._transport",
|
|
@@ -453,7 +484,7 @@ var Connection = class {
|
|
|
453
484
|
msg: msg.data
|
|
454
485
|
}, {
|
|
455
486
|
F: __dxlog_file,
|
|
456
|
-
L:
|
|
487
|
+
L: 361,
|
|
457
488
|
S: this,
|
|
458
489
|
C: (f, a) => f(...a)
|
|
459
490
|
});
|
|
@@ -467,17 +498,17 @@ var Connection = class {
|
|
|
467
498
|
_changeState(state) {
|
|
468
499
|
log("stateChanged", {
|
|
469
500
|
from: this._state,
|
|
470
|
-
|
|
501
|
+
to: state,
|
|
471
502
|
peerId: this.ownId
|
|
472
503
|
}, {
|
|
473
504
|
F: __dxlog_file,
|
|
474
|
-
L:
|
|
505
|
+
L: 372,
|
|
475
506
|
S: this,
|
|
476
507
|
C: (f, a) => f(...a)
|
|
477
508
|
});
|
|
478
509
|
invariant(state !== this._state, "Already in this state.", {
|
|
479
510
|
F: __dxlog_file,
|
|
480
|
-
L:
|
|
511
|
+
L: 373,
|
|
481
512
|
S: this,
|
|
482
513
|
A: [
|
|
483
514
|
"state !== this._state",
|
|
@@ -502,7 +533,7 @@ import { PublicKey as PublicKey2 } from "@dxos/keys";
|
|
|
502
533
|
import { log as log2 } from "@dxos/log";
|
|
503
534
|
import { schema } from "@dxos/protocols";
|
|
504
535
|
import { ComplexMap } from "@dxos/util";
|
|
505
|
-
var __dxlog_file2 = "/
|
|
536
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/signal/swarm-messenger.ts";
|
|
506
537
|
var SwarmMessage = schema.getCodecForType("dxos.mesh.swarm.SwarmMessage");
|
|
507
538
|
var SwarmMessenger = class {
|
|
508
539
|
constructor({ sendMessage, onSignal, onOffer, topic }) {
|
|
@@ -740,7 +771,7 @@ import { ComplexMap as ComplexMap2, isNotNullOrUndefined } from "@dxos/util";
|
|
|
740
771
|
// packages/core/mesh/network-manager/src/swarm/peer.ts
|
|
741
772
|
import { Event as Event2, scheduleTask, synchronized as synchronized2 } from "@dxos/async";
|
|
742
773
|
import { Context as Context3 } from "@dxos/context";
|
|
743
|
-
import { CancelledError as CancelledError2, SystemError } from "@dxos/errors";
|
|
774
|
+
import { CancelledError as CancelledError2, SystemError, TimeoutError } from "@dxos/errors";
|
|
744
775
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
745
776
|
import { PublicKey as PublicKey3 } from "@dxos/keys";
|
|
746
777
|
import { log as log3 } from "@dxos/log";
|
|
@@ -754,7 +785,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
754
785
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
755
786
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
756
787
|
}
|
|
757
|
-
var __dxlog_file3 = "/
|
|
788
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/peer.ts";
|
|
758
789
|
var ConnectionDisplacedError = class extends SystemError {
|
|
759
790
|
constructor() {
|
|
760
791
|
super("Connection displaced by remote initiator.");
|
|
@@ -933,6 +964,9 @@ var Peer = class {
|
|
|
933
964
|
S: this,
|
|
934
965
|
C: (f, a) => f(...a)
|
|
935
966
|
});
|
|
967
|
+
if (err instanceof TimeoutError) {
|
|
968
|
+
await connection.abort(err);
|
|
969
|
+
}
|
|
936
970
|
await this.closeConnection(err);
|
|
937
971
|
throw err;
|
|
938
972
|
} finally {
|
|
@@ -952,13 +986,13 @@ var Peer = class {
|
|
|
952
986
|
sessionId
|
|
953
987
|
}, {
|
|
954
988
|
F: __dxlog_file3,
|
|
955
|
-
L:
|
|
989
|
+
L: 213,
|
|
956
990
|
S: this,
|
|
957
991
|
C: (f, a) => f(...a)
|
|
958
992
|
});
|
|
959
993
|
invariant3(!this.connection, "Already connected.", {
|
|
960
994
|
F: __dxlog_file3,
|
|
961
|
-
L:
|
|
995
|
+
L: 220,
|
|
962
996
|
S: this,
|
|
963
997
|
A: [
|
|
964
998
|
"!this.connection",
|
|
@@ -994,7 +1028,7 @@ var Peer = class {
|
|
|
994
1028
|
initiator
|
|
995
1029
|
}, {
|
|
996
1030
|
F: __dxlog_file3,
|
|
997
|
-
L:
|
|
1031
|
+
L: 239,
|
|
998
1032
|
S: this,
|
|
999
1033
|
C: (f, a) => f(...a)
|
|
1000
1034
|
});
|
|
@@ -1007,14 +1041,14 @@ var Peer = class {
|
|
|
1007
1041
|
initiator
|
|
1008
1042
|
}, {
|
|
1009
1043
|
F: __dxlog_file3,
|
|
1010
|
-
L:
|
|
1044
|
+
L: 248,
|
|
1011
1045
|
S: this,
|
|
1012
1046
|
C: (f, a) => f(...a)
|
|
1013
1047
|
});
|
|
1014
1048
|
this._connectionLimiter.doneConnecting(sessionId);
|
|
1015
1049
|
invariant3(this.connection === connection, "Connection mismatch (race condition).", {
|
|
1016
1050
|
F: __dxlog_file3,
|
|
1017
|
-
L:
|
|
1051
|
+
L: 253,
|
|
1018
1052
|
S: this,
|
|
1019
1053
|
A: [
|
|
1020
1054
|
"this.connection === connection",
|
|
@@ -1029,7 +1063,7 @@ var Peer = class {
|
|
|
1029
1063
|
initiator
|
|
1030
1064
|
}, {
|
|
1031
1065
|
F: __dxlog_file3,
|
|
1032
|
-
L:
|
|
1066
|
+
L: 255,
|
|
1033
1067
|
S: this,
|
|
1034
1068
|
C: (f, a) => f(...a)
|
|
1035
1069
|
});
|
|
@@ -1064,7 +1098,7 @@ var Peer = class {
|
|
|
1064
1098
|
err
|
|
1065
1099
|
}, {
|
|
1066
1100
|
F: __dxlog_file3,
|
|
1067
|
-
L:
|
|
1101
|
+
L: 295,
|
|
1068
1102
|
S: this,
|
|
1069
1103
|
C: (f, a) => f(...a)
|
|
1070
1104
|
});
|
|
@@ -1077,7 +1111,7 @@ var Peer = class {
|
|
|
1077
1111
|
err
|
|
1078
1112
|
}, {
|
|
1079
1113
|
F: __dxlog_file3,
|
|
1080
|
-
L:
|
|
1114
|
+
L: 296,
|
|
1081
1115
|
S: this,
|
|
1082
1116
|
C: (f, a) => f(...a)
|
|
1083
1117
|
});
|
|
@@ -1096,7 +1130,7 @@ var Peer = class {
|
|
|
1096
1130
|
sessionId: connection.sessionId
|
|
1097
1131
|
}, {
|
|
1098
1132
|
F: __dxlog_file3,
|
|
1099
|
-
L:
|
|
1133
|
+
L: 321,
|
|
1100
1134
|
S: this,
|
|
1101
1135
|
C: (f, a) => f(...a)
|
|
1102
1136
|
});
|
|
@@ -1106,7 +1140,7 @@ var Peer = class {
|
|
|
1106
1140
|
sessionId: connection.sessionId
|
|
1107
1141
|
}, {
|
|
1108
1142
|
F: __dxlog_file3,
|
|
1109
|
-
L:
|
|
1143
|
+
L: 327,
|
|
1110
1144
|
S: this,
|
|
1111
1145
|
C: (f, a) => f(...a)
|
|
1112
1146
|
});
|
|
@@ -1117,7 +1151,7 @@ var Peer = class {
|
|
|
1117
1151
|
message
|
|
1118
1152
|
}, {
|
|
1119
1153
|
F: __dxlog_file3,
|
|
1120
|
-
L:
|
|
1154
|
+
L: 332,
|
|
1121
1155
|
S: this,
|
|
1122
1156
|
C: (f, a) => f(...a)
|
|
1123
1157
|
});
|
|
@@ -1132,7 +1166,7 @@ var Peer = class {
|
|
|
1132
1166
|
topic: this.topic
|
|
1133
1167
|
}, {
|
|
1134
1168
|
F: __dxlog_file3,
|
|
1135
|
-
L:
|
|
1169
|
+
L: 342,
|
|
1136
1170
|
S: this,
|
|
1137
1171
|
C: (f, a) => f(...a)
|
|
1138
1172
|
});
|
|
@@ -1166,7 +1200,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
1166
1200
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1167
1201
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1168
1202
|
}
|
|
1169
|
-
var __dxlog_file4 = "/
|
|
1203
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/swarm.ts";
|
|
1170
1204
|
var INITIATION_DELAY = 100;
|
|
1171
1205
|
var getClassName = (obj) => Object.getPrototypeOf(obj).constructor.name;
|
|
1172
1206
|
var Swarm = class {
|
|
@@ -1640,7 +1674,7 @@ import { Event as Event4, EventSubscriptions } from "@dxos/async";
|
|
|
1640
1674
|
import { PublicKey as PublicKey5 } from "@dxos/keys";
|
|
1641
1675
|
import { log as log5 } from "@dxos/log";
|
|
1642
1676
|
import { ComplexMap as ComplexMap3 } from "@dxos/util";
|
|
1643
|
-
var __dxlog_file5 = "/
|
|
1677
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/swarm-mapper.ts";
|
|
1644
1678
|
var SwarmMapper = class {
|
|
1645
1679
|
get peers() {
|
|
1646
1680
|
return Array.from(this._peers.values());
|
|
@@ -1713,7 +1747,7 @@ import { invariant as invariant5 } from "@dxos/invariant";
|
|
|
1713
1747
|
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
1714
1748
|
import { log as log6 } from "@dxos/log";
|
|
1715
1749
|
import { ComplexMap as ComplexMap4 } from "@dxos/util";
|
|
1716
|
-
var __dxlog_file6 = "/
|
|
1750
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection-limiter.ts";
|
|
1717
1751
|
var MAX_CONCURRENT_INITIATING_CONNECTIONS = 10;
|
|
1718
1752
|
var ConnectionLimiter = class {
|
|
1719
1753
|
constructor({ maxConcurrentInitConnections = MAX_CONCURRENT_INITIATING_CONNECTIONS } = {}) {
|
|
@@ -1866,7 +1900,7 @@ import { Messenger } from "@dxos/messaging";
|
|
|
1866
1900
|
import { trace as trace3 } from "@dxos/protocols";
|
|
1867
1901
|
import { ConnectionState as ConnectionState2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1868
1902
|
import { ComplexMap as ComplexMap6 } from "@dxos/util";
|
|
1869
|
-
var __dxlog_file7 = "/
|
|
1903
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/network-manager.ts";
|
|
1870
1904
|
var NetworkManager = class {
|
|
1871
1905
|
constructor({ transportFactory, signalManager, log: log1 }) {
|
|
1872
1906
|
/**
|
|
@@ -2102,7 +2136,7 @@ var NetworkManager = class {
|
|
|
2102
2136
|
|
|
2103
2137
|
// packages/core/mesh/network-manager/src/topology/fully-connected-topology.ts
|
|
2104
2138
|
import { invariant as invariant7 } from "@dxos/invariant";
|
|
2105
|
-
var __dxlog_file8 = "/
|
|
2139
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/fully-connected-topology.ts";
|
|
2106
2140
|
var FullyConnectedTopology = class {
|
|
2107
2141
|
toString() {
|
|
2108
2142
|
return "FullyConnectedTopology";
|
|
@@ -2145,7 +2179,7 @@ var FullyConnectedTopology = class {
|
|
|
2145
2179
|
import distance from "xor-distance";
|
|
2146
2180
|
import { invariant as invariant8 } from "@dxos/invariant";
|
|
2147
2181
|
import { log as log8 } from "@dxos/log";
|
|
2148
|
-
var __dxlog_file9 = "/
|
|
2182
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/mmst-topology.ts";
|
|
2149
2183
|
var MMSTTopology = class {
|
|
2150
2184
|
constructor({ originateConnections = 2, maxPeers = 4, sampleSize = 10 } = {}) {
|
|
2151
2185
|
this._sampleCollected = false;
|
|
@@ -2254,7 +2288,7 @@ var sortByXorDistance = (keys, reference) => keys.sort((a, b) => distance.gt(dis
|
|
|
2254
2288
|
// packages/core/mesh/network-manager/src/topology/star-topology.ts
|
|
2255
2289
|
import { invariant as invariant9 } from "@dxos/invariant";
|
|
2256
2290
|
import { log as log9 } from "@dxos/log";
|
|
2257
|
-
var __dxlog_file10 = "/
|
|
2291
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/star-topology.ts";
|
|
2258
2292
|
var StarTopology = class {
|
|
2259
2293
|
// prettier-ignore
|
|
2260
2294
|
constructor(_centralPeer) {
|
|
@@ -2366,7 +2400,7 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
2366
2400
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2367
2401
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2368
2402
|
}
|
|
2369
|
-
var __dxlog_file11 = "/
|
|
2403
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/memory-transport.ts";
|
|
2370
2404
|
var MEMORY_TRANSPORT_DELAY = 1;
|
|
2371
2405
|
var createStreamDelay = (delay) => {
|
|
2372
2406
|
return new Transform({
|
|
@@ -2541,6 +2575,7 @@ var TransportKind;
|
|
|
2541
2575
|
TransportKind2["LIBDATACHANNEL"] = "LIBDATACHANNEL";
|
|
2542
2576
|
TransportKind2["SIMPLE_PEER_PROXY"] = "SIMPLE_PEER_PROXY";
|
|
2543
2577
|
TransportKind2["MEMORY"] = "MEMORY";
|
|
2578
|
+
TransportKind2["TCP"] = "TCP";
|
|
2544
2579
|
})(TransportKind || (TransportKind = {}));
|
|
2545
2580
|
|
|
2546
2581
|
// packages/core/mesh/network-manager/src/transport/simplepeer-transport.ts
|
|
@@ -2548,6 +2583,7 @@ import SimplePeerConstructor from "simple-peer";
|
|
|
2548
2583
|
import invariant11 from "tiny-invariant";
|
|
2549
2584
|
import { Event as Event8 } from "@dxos/async";
|
|
2550
2585
|
import { ErrorStream as ErrorStream4, raise as raise2 } from "@dxos/debug";
|
|
2586
|
+
import { ConnectionResetError as ConnectionResetError2, ConnectivityError as ConnectivityError2, ProtocolError as ProtocolError2, UnknownProtocolError as UnknownProtocolError2 } from "@dxos/errors";
|
|
2551
2587
|
import { PublicKey as PublicKey10 } from "@dxos/keys";
|
|
2552
2588
|
import { log as log11 } from "@dxos/log";
|
|
2553
2589
|
import { trace as trace4 } from "@dxos/protocols";
|
|
@@ -2560,7 +2596,7 @@ try {
|
|
|
2560
2596
|
}
|
|
2561
2597
|
|
|
2562
2598
|
// packages/core/mesh/network-manager/src/transport/simplepeer-transport.ts
|
|
2563
|
-
var __dxlog_file12 = "/
|
|
2599
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport.ts";
|
|
2564
2600
|
var SimplePeerTransport = class {
|
|
2565
2601
|
constructor(params) {
|
|
2566
2602
|
this.params = params;
|
|
@@ -2573,13 +2609,13 @@ var SimplePeerTransport = class {
|
|
|
2573
2609
|
id: this._instanceId
|
|
2574
2610
|
}), {
|
|
2575
2611
|
F: __dxlog_file12,
|
|
2576
|
-
L:
|
|
2612
|
+
L: 41,
|
|
2577
2613
|
S: this,
|
|
2578
2614
|
C: (f, a) => f(...a)
|
|
2579
2615
|
});
|
|
2580
2616
|
log11("created connection", params, {
|
|
2581
2617
|
F: __dxlog_file12,
|
|
2582
|
-
L:
|
|
2618
|
+
L: 42,
|
|
2583
2619
|
S: this,
|
|
2584
2620
|
C: (f, a) => f(...a)
|
|
2585
2621
|
});
|
|
@@ -2592,7 +2628,7 @@ var SimplePeerTransport = class {
|
|
|
2592
2628
|
this._peer.on("signal", async (data) => {
|
|
2593
2629
|
log11("signal", data, {
|
|
2594
2630
|
F: __dxlog_file12,
|
|
2595
|
-
L:
|
|
2631
|
+
L: 51,
|
|
2596
2632
|
S: this,
|
|
2597
2633
|
C: (f, a) => f(...a)
|
|
2598
2634
|
});
|
|
@@ -2605,7 +2641,7 @@ var SimplePeerTransport = class {
|
|
|
2605
2641
|
this._peer.on("connect", () => {
|
|
2606
2642
|
log11("connected", void 0, {
|
|
2607
2643
|
F: __dxlog_file12,
|
|
2608
|
-
L:
|
|
2644
|
+
L: 56,
|
|
2609
2645
|
S: this,
|
|
2610
2646
|
C: (f, a) => f(...a)
|
|
2611
2647
|
});
|
|
@@ -2615,7 +2651,7 @@ var SimplePeerTransport = class {
|
|
|
2615
2651
|
this._peer.on("close", async () => {
|
|
2616
2652
|
log11("closed", void 0, {
|
|
2617
2653
|
F: __dxlog_file12,
|
|
2618
|
-
L:
|
|
2654
|
+
L: 62,
|
|
2619
2655
|
S: this,
|
|
2620
2656
|
C: (f, a) => f(...a)
|
|
2621
2657
|
});
|
|
@@ -2623,7 +2659,35 @@ var SimplePeerTransport = class {
|
|
|
2623
2659
|
this.closed.emit();
|
|
2624
2660
|
});
|
|
2625
2661
|
this._peer.on("error", async (err) => {
|
|
2626
|
-
|
|
2662
|
+
if (typeof RTCError !== "undefined" && err instanceof RTCError) {
|
|
2663
|
+
if (err.errorDetail === "sctp-failure") {
|
|
2664
|
+
this.errors.raise(new ConnectionResetError2("sctp-failure from RTCError", err));
|
|
2665
|
+
} else {
|
|
2666
|
+
this.errors.raise(new UnknownProtocolError2("unknown RTCError", err));
|
|
2667
|
+
}
|
|
2668
|
+
} else if (err.name === "InvalidStateError") {
|
|
2669
|
+
this.errors.raise(new ConnectionResetError2("safari WebRTC error", err));
|
|
2670
|
+
} else if ("code" in err) {
|
|
2671
|
+
switch (err.code) {
|
|
2672
|
+
case "ERR_WEBRTC_SUPPORT":
|
|
2673
|
+
this.errors.raise(new ProtocolError2("WebRTC not supported", err));
|
|
2674
|
+
case "ERR_ICE_CONNECTION_FAILURE":
|
|
2675
|
+
case "ERR_DATA_CHANNEL":
|
|
2676
|
+
case "ERR_CONNECTION_FAILURE":
|
|
2677
|
+
case "ERR_SIGNALING":
|
|
2678
|
+
this.errors.raise(new ConnectivityError2("unknown communication failure", err));
|
|
2679
|
+
case "ERR_CREATE_OFFER":
|
|
2680
|
+
case "ERR_CREATE_ANSWER":
|
|
2681
|
+
case "ERR_SET_LOCAL_DESCRIPTION":
|
|
2682
|
+
case "ERR_SET_REMOTE_DESCRIPTION":
|
|
2683
|
+
case "ERR_ADD_ICE_CANDIDATE":
|
|
2684
|
+
this.errors.raise(new UnknownProtocolError2("unknown simple-peer library failure", err));
|
|
2685
|
+
default:
|
|
2686
|
+
this.errors.raise(new Error("unknown simple-peer error"));
|
|
2687
|
+
}
|
|
2688
|
+
} else {
|
|
2689
|
+
this.errors.raise(err);
|
|
2690
|
+
}
|
|
2627
2691
|
try {
|
|
2628
2692
|
if (typeof this._peer?._pc.getStats === "function") {
|
|
2629
2693
|
this._peer._pc.getStats().then((stats) => {
|
|
@@ -2632,13 +2696,19 @@ var SimplePeerTransport = class {
|
|
|
2632
2696
|
stats
|
|
2633
2697
|
}, {
|
|
2634
2698
|
F: __dxlog_file12,
|
|
2635
|
-
L:
|
|
2699
|
+
L: 107,
|
|
2636
2700
|
S: this,
|
|
2637
2701
|
C: (f, a) => f(...a)
|
|
2638
2702
|
});
|
|
2639
2703
|
});
|
|
2640
2704
|
}
|
|
2641
|
-
} catch {
|
|
2705
|
+
} catch (err2) {
|
|
2706
|
+
log11.catch(err2, void 0, {
|
|
2707
|
+
F: __dxlog_file12,
|
|
2708
|
+
L: 114,
|
|
2709
|
+
S: this,
|
|
2710
|
+
C: (f, a) => f(...a)
|
|
2711
|
+
});
|
|
2642
2712
|
}
|
|
2643
2713
|
await this.destroy();
|
|
2644
2714
|
});
|
|
@@ -2646,7 +2716,7 @@ var SimplePeerTransport = class {
|
|
|
2646
2716
|
id: this._instanceId
|
|
2647
2717
|
}), {
|
|
2648
2718
|
F: __dxlog_file12,
|
|
2649
|
-
L:
|
|
2719
|
+
L: 119,
|
|
2650
2720
|
S: this,
|
|
2651
2721
|
C: (f, a) => f(...a)
|
|
2652
2722
|
});
|
|
@@ -2654,7 +2724,7 @@ var SimplePeerTransport = class {
|
|
|
2654
2724
|
async destroy() {
|
|
2655
2725
|
log11("closing...", void 0, {
|
|
2656
2726
|
F: __dxlog_file12,
|
|
2657
|
-
L:
|
|
2727
|
+
L: 123,
|
|
2658
2728
|
S: this,
|
|
2659
2729
|
C: (f, a) => f(...a)
|
|
2660
2730
|
});
|
|
@@ -2664,7 +2734,7 @@ var SimplePeerTransport = class {
|
|
|
2664
2734
|
this.closed.emit();
|
|
2665
2735
|
log11("closed", void 0, {
|
|
2666
2736
|
F: __dxlog_file12,
|
|
2667
|
-
L:
|
|
2737
|
+
L: 128,
|
|
2668
2738
|
S: this,
|
|
2669
2739
|
C: (f, a) => f(...a)
|
|
2670
2740
|
});
|
|
@@ -2695,7 +2765,7 @@ import { PublicKey as PublicKey11 } from "@dxos/keys";
|
|
|
2695
2765
|
import { log as log12 } from "@dxos/log";
|
|
2696
2766
|
import { ConnectionState as ConnectionState3 } from "@dxos/protocols/proto/dxos/mesh/bridge";
|
|
2697
2767
|
import { ComplexMap as ComplexMap8 } from "@dxos/util";
|
|
2698
|
-
var __dxlog_file13 = "/
|
|
2768
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport-service.ts";
|
|
2699
2769
|
var SimplePeerTransportService = class {
|
|
2700
2770
|
// prettier-ignore
|
|
2701
2771
|
constructor(_webrtcConfig) {
|
|
@@ -2822,12 +2892,13 @@ import { Writable } from "@dxos/node-std/stream";
|
|
|
2822
2892
|
import { Event as Event9 } from "@dxos/async";
|
|
2823
2893
|
import { Context as Context6 } from "@dxos/context";
|
|
2824
2894
|
import { ErrorStream as ErrorStream5 } from "@dxos/debug";
|
|
2895
|
+
import { ConnectionResetError as ConnectionResetError3, TimeoutError as TimeoutError2, ProtocolError as ProtocolError3, ConnectivityError as ConnectivityError3, UnknownProtocolError as UnknownProtocolError3 } from "@dxos/errors";
|
|
2825
2896
|
import { invariant as invariant13 } from "@dxos/invariant";
|
|
2826
2897
|
import { PublicKey as PublicKey12 } from "@dxos/keys";
|
|
2827
2898
|
import { log as log13 } from "@dxos/log";
|
|
2828
2899
|
import { ConnectionState as ConnectionState4 } from "@dxos/protocols/proto/dxos/mesh/bridge";
|
|
2829
2900
|
import { arrayToBuffer } from "@dxos/util";
|
|
2830
|
-
var __dxlog_file14 = "/
|
|
2901
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport-proxy.ts";
|
|
2831
2902
|
var SimplePeerTransportProxy = class {
|
|
2832
2903
|
// prettier-ignore
|
|
2833
2904
|
constructor(_params) {
|
|
@@ -2846,7 +2917,7 @@ var SimplePeerTransportProxy = class {
|
|
|
2846
2917
|
this._serviceStream.subscribe(async (event) => {
|
|
2847
2918
|
log13("SimplePeerTransportProxy: event", event, {
|
|
2848
2919
|
F: __dxlog_file14,
|
|
2849
|
-
L:
|
|
2920
|
+
L: 58,
|
|
2850
2921
|
S: this,
|
|
2851
2922
|
C: (f, a) => f(...a)
|
|
2852
2923
|
});
|
|
@@ -2866,7 +2937,7 @@ var SimplePeerTransportProxy = class {
|
|
|
2866
2937
|
}).then(() => callback(), (err) => {
|
|
2867
2938
|
log13.catch(err, void 0, {
|
|
2868
2939
|
F: __dxlog_file14,
|
|
2869
|
-
L:
|
|
2940
|
+
L: 76,
|
|
2870
2941
|
S: this,
|
|
2871
2942
|
C: (f, a) => f(...a)
|
|
2872
2943
|
});
|
|
@@ -2875,14 +2946,14 @@ var SimplePeerTransportProxy = class {
|
|
|
2875
2946
|
}));
|
|
2876
2947
|
}, (error) => log13.catch(error, void 0, {
|
|
2877
2948
|
F: __dxlog_file14,
|
|
2878
|
-
L:
|
|
2949
|
+
L: 82,
|
|
2879
2950
|
S: this,
|
|
2880
2951
|
C: (f, a) => f(...a)
|
|
2881
2952
|
}));
|
|
2882
2953
|
}
|
|
2883
2954
|
async _handleConnection(connectionEvent) {
|
|
2884
2955
|
if (connectionEvent.error) {
|
|
2885
|
-
this.errors.raise(
|
|
2956
|
+
this.errors.raise(decodeError(connectionEvent.error));
|
|
2886
2957
|
}
|
|
2887
2958
|
switch (connectionEvent.state) {
|
|
2888
2959
|
case ConnectionState4.CONNECTED: {
|
|
@@ -2905,7 +2976,7 @@ var SimplePeerTransportProxy = class {
|
|
|
2905
2976
|
this._params.bridgeService.sendSignal({
|
|
2906
2977
|
proxyId: this._proxyId,
|
|
2907
2978
|
signal
|
|
2908
|
-
}).catch((err) => this.errors.raise(err));
|
|
2979
|
+
}).catch((err) => this.errors.raise(decodeError(err)));
|
|
2909
2980
|
}
|
|
2910
2981
|
// TODO(burdon): Move open from constructor.
|
|
2911
2982
|
async destroy() {
|
|
@@ -2921,7 +2992,7 @@ var SimplePeerTransportProxy = class {
|
|
|
2921
2992
|
} catch (err) {
|
|
2922
2993
|
log13.catch(err, void 0, {
|
|
2923
2994
|
F: __dxlog_file14,
|
|
2924
|
-
L:
|
|
2995
|
+
L: 133,
|
|
2925
2996
|
S: this,
|
|
2926
2997
|
C: (f, a) => f(...a)
|
|
2927
2998
|
});
|
|
@@ -2957,7 +3028,7 @@ var SimplePeerTransportProxyFactory = class {
|
|
|
2957
3028
|
createTransport(options) {
|
|
2958
3029
|
invariant13(this._bridgeService, "SimplePeerTransportProxyFactory is not ready to open connections", {
|
|
2959
3030
|
F: __dxlog_file14,
|
|
2960
|
-
L:
|
|
3031
|
+
L: 170,
|
|
2961
3032
|
S: this,
|
|
2962
3033
|
A: [
|
|
2963
3034
|
"this._bridgeService",
|
|
@@ -2973,6 +3044,22 @@ var SimplePeerTransportProxyFactory = class {
|
|
|
2973
3044
|
return transport;
|
|
2974
3045
|
}
|
|
2975
3046
|
};
|
|
3047
|
+
var decodeError = (err) => {
|
|
3048
|
+
const message = typeof err === "string" ? err : err.message;
|
|
3049
|
+
if (message.includes("ConnectionResetError")) {
|
|
3050
|
+
return new ConnectionResetError3(message);
|
|
3051
|
+
} else if (message.includes("TimeoutError")) {
|
|
3052
|
+
return new TimeoutError2(message);
|
|
3053
|
+
} else if (message.includes("ProtocolError")) {
|
|
3054
|
+
return new ProtocolError3(message);
|
|
3055
|
+
} else if (message.includes("ConnectivityError")) {
|
|
3056
|
+
return new ConnectivityError3(message);
|
|
3057
|
+
} else if (message.includes("UnknownProtocolError")) {
|
|
3058
|
+
return new UnknownProtocolError3(message);
|
|
3059
|
+
} else {
|
|
3060
|
+
return typeof err === "string" ? new Error(err) : err;
|
|
3061
|
+
}
|
|
3062
|
+
};
|
|
2976
3063
|
|
|
2977
3064
|
// packages/core/mesh/network-manager/src/transport/libdatachannel-transport.ts
|
|
2978
3065
|
import { Duplex as Duplex2 } from "stream";
|
|
@@ -2989,7 +3076,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
2989
3076
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2990
3077
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2991
3078
|
}
|
|
2992
|
-
var __dxlog_file15 = "/
|
|
3079
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/libdatachannel-transport.ts";
|
|
2993
3080
|
var DATACHANNEL_LABEL = "dxos.mesh.transport";
|
|
2994
3081
|
var MAX_BUFFERED_AMOUNT = 64 * 1024;
|
|
2995
3082
|
var MAX_MESSAGE_SIZE = 64 * 1024;
|
|
@@ -3360,4 +3447,4 @@ export {
|
|
|
3360
3447
|
createLibDataChannelTransportFactory,
|
|
3361
3448
|
createTeleportProtocolFactory
|
|
3362
3449
|
};
|
|
3363
|
-
//# sourceMappingURL=chunk-
|
|
3450
|
+
//# sourceMappingURL=chunk-PSWNMALH.mjs.map
|