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