@dxos/network-manager 0.3.8 → 0.3.9-main.1d6fb54
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-H7XJ7HES.mjs → chunk-4HITD6WI.mjs} +129 -77
- package/dist/lib/browser/chunk-4HITD6WI.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 +3 -3
- package/dist/lib/node/{chunk-RBHZCZH4.cjs → chunk-6AD7QA4X.cjs} +126 -74
- package/dist/lib/node/chunk-6AD7QA4X.cjs.map +7 -0
- package/dist/lib/node/index.cjs +27 -27
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +20 -20
- package/dist/types/src/connection-log.d.ts.map +1 -1
- package/dist/types/src/swarm/connection.d.ts.map +1 -1
- package/dist/types/src/transport/libdatachannel-transport.d.ts.map +1 -1
- package/dist/types/src/transport/simplepeer-transport.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/connection-log.ts +13 -0
- package/src/swarm/connection.ts +17 -2
- package/src/transport/libdatachannel-transport.ts +7 -3
- package/src/transport/simplepeer-transport.ts +4 -1
- package/dist/lib/browser/chunk-H7XJ7HES.mjs.map +0 -7
- package/dist/lib/node/chunk-RBHZCZH4.cjs.map +0 -7
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_6AD7QA4X_exports = {};
|
|
30
|
+
__export(chunk_6AD7QA4X_exports, {
|
|
31
31
|
Connection: () => Connection,
|
|
32
32
|
ConnectionLimiter: () => ConnectionLimiter,
|
|
33
33
|
ConnectionLog: () => ConnectionLog,
|
|
@@ -55,7 +55,7 @@ __export(chunk_RBHZCZH4_exports, {
|
|
|
55
55
|
createSimplePeerTransportFactory: () => createSimplePeerTransportFactory,
|
|
56
56
|
createTeleportProtocolFactory: () => createTeleportProtocolFactory
|
|
57
57
|
});
|
|
58
|
-
module.exports = __toCommonJS(
|
|
58
|
+
module.exports = __toCommonJS(chunk_6AD7QA4X_exports);
|
|
59
59
|
var import_chunk_XE5JOIGD = require("./chunk-XE5JOIGD.cjs");
|
|
60
60
|
var import_async = require("@dxos/async");
|
|
61
61
|
var import_context = require("@dxos/context");
|
|
@@ -163,7 +163,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
163
163
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
164
164
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
165
165
|
}
|
|
166
|
-
var __dxlog_file = "/home/
|
|
166
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection.ts";
|
|
167
167
|
var STARTING_SIGNALLING_DELAY = 10;
|
|
168
168
|
var TRANSPORT_CONNECTION_TIMEOUT = 1e4;
|
|
169
169
|
var MAX_SIGNALLING_DELAY = 300;
|
|
@@ -240,7 +240,7 @@ var Connection = class {
|
|
|
240
240
|
initiator: this.initiator
|
|
241
241
|
}, {
|
|
242
242
|
F: __dxlog_file,
|
|
243
|
-
L:
|
|
243
|
+
L: 130,
|
|
244
244
|
S: this,
|
|
245
245
|
C: (f, a) => f(...a)
|
|
246
246
|
});
|
|
@@ -260,7 +260,7 @@ var Connection = class {
|
|
|
260
260
|
async openConnection() {
|
|
261
261
|
(0, import_invariant.invariant)(this._state === ConnectionState.INITIAL, "Invalid state.", {
|
|
262
262
|
F: __dxlog_file,
|
|
263
|
-
L:
|
|
263
|
+
L: 155,
|
|
264
264
|
S: this,
|
|
265
265
|
A: [
|
|
266
266
|
"this._state === ConnectionState.INITIAL",
|
|
@@ -271,7 +271,7 @@ var Connection = class {
|
|
|
271
271
|
id: this._instanceId
|
|
272
272
|
}), {
|
|
273
273
|
F: __dxlog_file,
|
|
274
|
-
L:
|
|
274
|
+
L: 156,
|
|
275
275
|
S: this,
|
|
276
276
|
C: (f, a) => f(...a)
|
|
277
277
|
});
|
|
@@ -283,7 +283,7 @@ var Connection = class {
|
|
|
283
283
|
initiator: this.initiator
|
|
284
284
|
}, {
|
|
285
285
|
F: __dxlog_file,
|
|
286
|
-
L:
|
|
286
|
+
L: 157,
|
|
287
287
|
S: this,
|
|
288
288
|
C: (f, a) => f(...a)
|
|
289
289
|
});
|
|
@@ -294,24 +294,24 @@ var Connection = class {
|
|
|
294
294
|
this._protocol.stream.on("close", () => {
|
|
295
295
|
(0, import_log.log)("protocol stream closed", void 0, {
|
|
296
296
|
F: __dxlog_file,
|
|
297
|
-
L:
|
|
297
|
+
L: 174,
|
|
298
298
|
S: this,
|
|
299
299
|
C: (f, a) => f(...a)
|
|
300
300
|
});
|
|
301
301
|
this.close(new import_protocols.ProtocolError("protocol stream closed")).catch((err) => this.errors.raise(err));
|
|
302
302
|
});
|
|
303
303
|
(0, import_async.scheduleTask)(this.connectedTimeoutContext, async () => {
|
|
304
|
-
import_log.log.info(
|
|
304
|
+
import_log.log.info(`timeout waiting ${TRANSPORT_CONNECTION_TIMEOUT / 1e3}s for transport to connect, aborting`, void 0, {
|
|
305
305
|
F: __dxlog_file,
|
|
306
|
-
L:
|
|
306
|
+
L: 181,
|
|
307
307
|
S: this,
|
|
308
308
|
C: (f, a) => f(...a)
|
|
309
309
|
});
|
|
310
|
-
await this.abort().catch((err) => this.errors.raise(err));
|
|
310
|
+
await this.abort(new import_protocols.TimeoutError(`${TRANSPORT_CONNECTION_TIMEOUT / 1e3}s for transport to connect`)).catch((err) => this.errors.raise(err));
|
|
311
311
|
}, TRANSPORT_CONNECTION_TIMEOUT);
|
|
312
312
|
(0, import_invariant.invariant)(!this._transport, void 0, {
|
|
313
313
|
F: __dxlog_file,
|
|
314
|
-
L:
|
|
314
|
+
L: 189,
|
|
315
315
|
S: this,
|
|
316
316
|
A: [
|
|
317
317
|
"!this._transport",
|
|
@@ -332,7 +332,7 @@ var Connection = class {
|
|
|
332
332
|
this._transport = void 0;
|
|
333
333
|
(0, import_log.log)("abort triggered by transport close", void 0, {
|
|
334
334
|
F: __dxlog_file,
|
|
335
|
-
L:
|
|
335
|
+
L: 204,
|
|
336
336
|
S: this,
|
|
337
337
|
C: (f, a) => f(...a)
|
|
338
338
|
});
|
|
@@ -343,7 +343,7 @@ var Connection = class {
|
|
|
343
343
|
err
|
|
344
344
|
}, {
|
|
345
345
|
F: __dxlog_file,
|
|
346
|
-
L:
|
|
346
|
+
L: 209,
|
|
347
347
|
S: this,
|
|
348
348
|
C: (f, a) => f(...a)
|
|
349
349
|
});
|
|
@@ -353,7 +353,7 @@ var Connection = class {
|
|
|
353
353
|
if (err instanceof import_protocols.ConnectionResetError) {
|
|
354
354
|
import_log.log.info("aborting due to transport ConnectionResetError", void 0, {
|
|
355
355
|
F: __dxlog_file,
|
|
356
|
-
L:
|
|
356
|
+
L: 216,
|
|
357
357
|
S: this,
|
|
358
358
|
C: (f, a) => f(...a)
|
|
359
359
|
});
|
|
@@ -361,7 +361,7 @@ var Connection = class {
|
|
|
361
361
|
} else if (err instanceof import_protocols.ConnectivityError) {
|
|
362
362
|
import_log.log.info("aborting due to transport ConnectivityError", void 0, {
|
|
363
363
|
F: __dxlog_file,
|
|
364
|
-
L:
|
|
364
|
+
L: 219,
|
|
365
365
|
S: this,
|
|
366
366
|
C: (f, a) => f(...a)
|
|
367
367
|
});
|
|
@@ -371,7 +371,7 @@ var Connection = class {
|
|
|
371
371
|
err
|
|
372
372
|
}, {
|
|
373
373
|
F: __dxlog_file,
|
|
374
|
-
L:
|
|
374
|
+
L: 222,
|
|
375
375
|
S: this,
|
|
376
376
|
C: (f, a) => f(...a)
|
|
377
377
|
});
|
|
@@ -389,7 +389,7 @@ var Connection = class {
|
|
|
389
389
|
id: this._instanceId
|
|
390
390
|
}), {
|
|
391
391
|
F: __dxlog_file,
|
|
392
|
-
L:
|
|
392
|
+
L: 238,
|
|
393
393
|
S: this,
|
|
394
394
|
C: (f, a) => f(...a)
|
|
395
395
|
});
|
|
@@ -399,14 +399,14 @@ var Connection = class {
|
|
|
399
399
|
err
|
|
400
400
|
}, {
|
|
401
401
|
F: __dxlog_file,
|
|
402
|
-
L:
|
|
402
|
+
L: 245,
|
|
403
403
|
S: this,
|
|
404
404
|
C: (f, a) => f(...a)
|
|
405
405
|
});
|
|
406
406
|
if (this._state === ConnectionState.CLOSED || this._state === ConnectionState.ABORTED) {
|
|
407
407
|
(0, import_log.log)(`abort ignored: already ${this._state}`, this.closeReason, {
|
|
408
408
|
F: __dxlog_file,
|
|
409
|
-
L:
|
|
409
|
+
L: 247,
|
|
410
410
|
S: this,
|
|
411
411
|
C: (f, a) => f(...a)
|
|
412
412
|
});
|
|
@@ -421,7 +421,7 @@ var Connection = class {
|
|
|
421
421
|
try {
|
|
422
422
|
(0, import_log.log)("aborting protocol... ", void 0, {
|
|
423
423
|
F: __dxlog_file,
|
|
424
|
-
L:
|
|
424
|
+
L: 261,
|
|
425
425
|
S: this,
|
|
426
426
|
C: (f, a) => f(...a)
|
|
427
427
|
});
|
|
@@ -429,7 +429,7 @@ var Connection = class {
|
|
|
429
429
|
} catch (err2) {
|
|
430
430
|
import_log.log.catch(err2, void 0, {
|
|
431
431
|
F: __dxlog_file,
|
|
432
|
-
L:
|
|
432
|
+
L: 264,
|
|
433
433
|
S: this,
|
|
434
434
|
C: (f, a) => f(...a)
|
|
435
435
|
});
|
|
@@ -439,7 +439,7 @@ var Connection = class {
|
|
|
439
439
|
} catch (err2) {
|
|
440
440
|
import_log.log.catch(err2, void 0, {
|
|
441
441
|
F: __dxlog_file,
|
|
442
|
-
L:
|
|
442
|
+
L: 271,
|
|
443
443
|
S: this,
|
|
444
444
|
C: (f, a) => f(...a)
|
|
445
445
|
});
|
|
@@ -449,7 +449,7 @@ var Connection = class {
|
|
|
449
449
|
} catch (err2) {
|
|
450
450
|
import_log.log.catch(err2, void 0, {
|
|
451
451
|
F: __dxlog_file,
|
|
452
|
-
L:
|
|
452
|
+
L: 277,
|
|
453
453
|
S: this,
|
|
454
454
|
C: (f, a) => f(...a)
|
|
455
455
|
});
|
|
@@ -473,7 +473,7 @@ var Connection = class {
|
|
|
473
473
|
peerId: this.ownId
|
|
474
474
|
}, {
|
|
475
475
|
F: __dxlog_file,
|
|
476
|
-
L:
|
|
476
|
+
L: 302,
|
|
477
477
|
S: this,
|
|
478
478
|
C: (f, a) => f(...a)
|
|
479
479
|
});
|
|
@@ -483,7 +483,7 @@ var Connection = class {
|
|
|
483
483
|
} catch (err2) {
|
|
484
484
|
import_log.log.catch(err2, void 0, {
|
|
485
485
|
F: __dxlog_file,
|
|
486
|
-
L:
|
|
486
|
+
L: 309,
|
|
487
487
|
S: this,
|
|
488
488
|
C: (f, a) => f(...a)
|
|
489
489
|
});
|
|
@@ -493,7 +493,34 @@ var Connection = class {
|
|
|
493
493
|
} catch (err2) {
|
|
494
494
|
import_log.log.catch(err2, void 0, {
|
|
495
495
|
F: __dxlog_file,
|
|
496
|
-
L:
|
|
496
|
+
L: 316,
|
|
497
|
+
S: this,
|
|
498
|
+
C: (f, a) => f(...a)
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
} else {
|
|
502
|
+
import_log.log.info(`graceful close requested when we were in ${lastState} state? aborting`, void 0, {
|
|
503
|
+
F: __dxlog_file,
|
|
504
|
+
L: 319,
|
|
505
|
+
S: this,
|
|
506
|
+
C: (f, a) => f(...a)
|
|
507
|
+
});
|
|
508
|
+
try {
|
|
509
|
+
await this._protocol.abort();
|
|
510
|
+
} catch (err2) {
|
|
511
|
+
import_log.log.catch(err2, void 0, {
|
|
512
|
+
F: __dxlog_file,
|
|
513
|
+
L: 323,
|
|
514
|
+
S: this,
|
|
515
|
+
C: (f, a) => f(...a)
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
try {
|
|
519
|
+
await this._transport?.destroy();
|
|
520
|
+
} catch (err2) {
|
|
521
|
+
import_log.log.catch(err2, void 0, {
|
|
522
|
+
F: __dxlog_file,
|
|
523
|
+
L: 328,
|
|
497
524
|
S: this,
|
|
498
525
|
C: (f, a) => f(...a)
|
|
499
526
|
});
|
|
@@ -503,7 +530,7 @@ var Connection = class {
|
|
|
503
530
|
peerId: this.ownId
|
|
504
531
|
}, {
|
|
505
532
|
F: __dxlog_file,
|
|
506
|
-
L:
|
|
533
|
+
L: 332,
|
|
507
534
|
S: this,
|
|
508
535
|
C: (f, a) => f(...a)
|
|
509
536
|
});
|
|
@@ -546,7 +573,7 @@ var Connection = class {
|
|
|
546
573
|
err
|
|
547
574
|
}, {
|
|
548
575
|
F: __dxlog_file,
|
|
549
|
-
L:
|
|
576
|
+
L: 370,
|
|
550
577
|
S: this,
|
|
551
578
|
C: (f, a) => f(...a)
|
|
552
579
|
});
|
|
@@ -559,7 +586,7 @@ var Connection = class {
|
|
|
559
586
|
async signal(msg) {
|
|
560
587
|
(0, import_invariant.invariant)(msg.sessionId, void 0, {
|
|
561
588
|
F: __dxlog_file,
|
|
562
|
-
L:
|
|
589
|
+
L: 379,
|
|
563
590
|
S: this,
|
|
564
591
|
A: [
|
|
565
592
|
"msg.sessionId",
|
|
@@ -569,7 +596,7 @@ var Connection = class {
|
|
|
569
596
|
if (!msg.sessionId.equals(this.sessionId)) {
|
|
570
597
|
(0, import_log.log)("dropping signal for incorrect session id", void 0, {
|
|
571
598
|
F: __dxlog_file,
|
|
572
|
-
L:
|
|
599
|
+
L: 381,
|
|
573
600
|
S: this,
|
|
574
601
|
C: (f, a) => f(...a)
|
|
575
602
|
});
|
|
@@ -577,7 +604,7 @@ var Connection = class {
|
|
|
577
604
|
}
|
|
578
605
|
(0, import_invariant.invariant)(msg.data.signal || msg.data.signalBatch, void 0, {
|
|
579
606
|
F: __dxlog_file,
|
|
580
|
-
L:
|
|
607
|
+
L: 384,
|
|
581
608
|
S: this,
|
|
582
609
|
A: [
|
|
583
610
|
"msg.data.signal || msg.data.signalBatch",
|
|
@@ -586,7 +613,7 @@ var Connection = class {
|
|
|
586
613
|
});
|
|
587
614
|
(0, import_invariant.invariant)(msg.author?.equals(this.remoteId), void 0, {
|
|
588
615
|
F: __dxlog_file,
|
|
589
|
-
L:
|
|
616
|
+
L: 385,
|
|
590
617
|
S: this,
|
|
591
618
|
A: [
|
|
592
619
|
"msg.author?.equals(this.remoteId)",
|
|
@@ -595,7 +622,7 @@ var Connection = class {
|
|
|
595
622
|
});
|
|
596
623
|
(0, import_invariant.invariant)(msg.recipient?.equals(this.ownId), void 0, {
|
|
597
624
|
F: __dxlog_file,
|
|
598
|
-
L:
|
|
625
|
+
L: 386,
|
|
599
626
|
S: this,
|
|
600
627
|
A: [
|
|
601
628
|
"msg.recipient?.equals(this.ownId)",
|
|
@@ -619,7 +646,7 @@ var Connection = class {
|
|
|
619
646
|
msg: msg.data
|
|
620
647
|
}, {
|
|
621
648
|
F: __dxlog_file,
|
|
622
|
-
L:
|
|
649
|
+
L: 395,
|
|
623
650
|
S: this,
|
|
624
651
|
C: (f, a) => f(...a)
|
|
625
652
|
});
|
|
@@ -627,7 +654,7 @@ var Connection = class {
|
|
|
627
654
|
} else {
|
|
628
655
|
(0, import_invariant.invariant)(this._transport, "Connection not ready to accept signals.", {
|
|
629
656
|
F: __dxlog_file,
|
|
630
|
-
L:
|
|
657
|
+
L: 398,
|
|
631
658
|
S: this,
|
|
632
659
|
A: [
|
|
633
660
|
"this._transport",
|
|
@@ -640,7 +667,7 @@ var Connection = class {
|
|
|
640
667
|
msg: msg.data
|
|
641
668
|
}, {
|
|
642
669
|
F: __dxlog_file,
|
|
643
|
-
L:
|
|
670
|
+
L: 399,
|
|
644
671
|
S: this,
|
|
645
672
|
C: (f, a) => f(...a)
|
|
646
673
|
});
|
|
@@ -658,13 +685,13 @@ var Connection = class {
|
|
|
658
685
|
peerId: this.ownId
|
|
659
686
|
}, {
|
|
660
687
|
F: __dxlog_file,
|
|
661
|
-
L:
|
|
688
|
+
L: 410,
|
|
662
689
|
S: this,
|
|
663
690
|
C: (f, a) => f(...a)
|
|
664
691
|
});
|
|
665
692
|
(0, import_invariant.invariant)(state !== this._state, "Already in this state.", {
|
|
666
693
|
F: __dxlog_file,
|
|
667
|
-
L:
|
|
694
|
+
L: 411,
|
|
668
695
|
S: this,
|
|
669
696
|
A: [
|
|
670
697
|
"state !== this._state",
|
|
@@ -681,7 +708,7 @@ _ts_decorate([
|
|
|
681
708
|
_ts_decorate([
|
|
682
709
|
import_async.synchronized
|
|
683
710
|
], Connection.prototype, "close", null);
|
|
684
|
-
var __dxlog_file2 = "/home/
|
|
711
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/signal/swarm-messenger.ts";
|
|
685
712
|
var SwarmMessage = import_protocols2.schema.getCodecForType("dxos.mesh.swarm.SwarmMessage");
|
|
686
713
|
var SwarmMessenger = class {
|
|
687
714
|
constructor({ sendMessage, onSignal, onOffer, topic }) {
|
|
@@ -926,7 +953,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
926
953
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
927
954
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
928
955
|
}
|
|
929
|
-
var __dxlog_file3 = "/home/
|
|
956
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/peer.ts";
|
|
930
957
|
var ConnectionDisplacedError = class extends import_protocols4.SystemError {
|
|
931
958
|
constructor() {
|
|
932
959
|
super("Connection displaced by remote initiator.");
|
|
@@ -1402,7 +1429,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
1402
1429
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1403
1430
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1404
1431
|
}
|
|
1405
|
-
var __dxlog_file4 = "/home/
|
|
1432
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/swarm.ts";
|
|
1406
1433
|
var INITIATION_DELAY = 100;
|
|
1407
1434
|
var getClassName = (obj) => Object.getPrototypeOf(obj).constructor.name;
|
|
1408
1435
|
var Swarm = class {
|
|
@@ -1887,7 +1914,7 @@ _ts_decorate3([
|
|
|
1887
1914
|
_ts_decorate3([
|
|
1888
1915
|
import_async2.synchronized
|
|
1889
1916
|
], Swarm.prototype, "goOnline", null);
|
|
1890
|
-
var __dxlog_file5 = "/home/
|
|
1917
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/swarm-mapper.ts";
|
|
1891
1918
|
var SwarmMapper = class {
|
|
1892
1919
|
get peers() {
|
|
1893
1920
|
return Array.from(this._peers.values());
|
|
@@ -1950,7 +1977,7 @@ var SwarmMapper = class {
|
|
|
1950
1977
|
this._subscriptions.clear();
|
|
1951
1978
|
}
|
|
1952
1979
|
};
|
|
1953
|
-
var __dxlog_file6 = "/home/
|
|
1980
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection-limiter.ts";
|
|
1954
1981
|
var MAX_CONCURRENT_INITIATING_CONNECTIONS = 50;
|
|
1955
1982
|
var ConnectionLimiter = class {
|
|
1956
1983
|
constructor({ maxConcurrentInitConnections = MAX_CONCURRENT_INITIATING_CONNECTIONS } = {}) {
|
|
@@ -2020,6 +2047,7 @@ var ConnectionLimiter = class {
|
|
|
2020
2047
|
this.resolveWaitingPromises.schedule();
|
|
2021
2048
|
}
|
|
2022
2049
|
};
|
|
2050
|
+
var CONNECTION_GC_THRESHOLD = 1e3 * 60 * 15;
|
|
2023
2051
|
var EventType;
|
|
2024
2052
|
(function(EventType2) {
|
|
2025
2053
|
EventType2["CONNECTION_STATE_CHANGED"] = "CONNECTION_STATE_CHANGED";
|
|
@@ -2057,13 +2085,15 @@ var ConnectionLog = class {
|
|
|
2057
2085
|
sessionId: connection.sessionId,
|
|
2058
2086
|
transport: connection.transport && Object.getPrototypeOf(connection.transport).constructor.name,
|
|
2059
2087
|
protocolExtensions: [],
|
|
2060
|
-
events: []
|
|
2088
|
+
events: [],
|
|
2089
|
+
lastUpdate: /* @__PURE__ */ new Date()
|
|
2061
2090
|
};
|
|
2062
2091
|
info.connections.push(connectionInfo);
|
|
2063
2092
|
this.update.emit();
|
|
2064
2093
|
connection.stateChanged.on((state) => {
|
|
2065
2094
|
connectionInfo.state = state;
|
|
2066
2095
|
connectionInfo.closeReason = connection.closeReason;
|
|
2096
|
+
connectionInfo.lastUpdate = /* @__PURE__ */ new Date();
|
|
2067
2097
|
connectionInfo.events.push({
|
|
2068
2098
|
type: EventType.CONNECTION_STATE_CHANGED,
|
|
2069
2099
|
newState: state
|
|
@@ -2074,8 +2104,10 @@ var ConnectionLog = class {
|
|
|
2074
2104
|
connectionInfo.readBufferSize = stats.readBufferSize;
|
|
2075
2105
|
connectionInfo.writeBufferSize = stats.writeBufferSize;
|
|
2076
2106
|
connectionInfo.streams = stats.channels;
|
|
2107
|
+
connectionInfo.lastUpdate = /* @__PURE__ */ new Date();
|
|
2077
2108
|
this.update.emit();
|
|
2078
2109
|
});
|
|
2110
|
+
gcSwarm(info);
|
|
2079
2111
|
});
|
|
2080
2112
|
}
|
|
2081
2113
|
leftSwarm(swarm) {
|
|
@@ -2083,7 +2115,12 @@ var ConnectionLog = class {
|
|
|
2083
2115
|
this.update.emit();
|
|
2084
2116
|
}
|
|
2085
2117
|
};
|
|
2086
|
-
var
|
|
2118
|
+
var gcSwarm = (swarm) => {
|
|
2119
|
+
swarm.connections = swarm.connections?.filter((connection) => {
|
|
2120
|
+
return connection.lastUpdate ? Date.now() - connection.lastUpdate.getTime() < CONNECTION_GC_THRESHOLD : true;
|
|
2121
|
+
});
|
|
2122
|
+
};
|
|
2123
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/network-manager.ts";
|
|
2087
2124
|
var NetworkManager = class {
|
|
2088
2125
|
constructor({ transportFactory, signalManager, log: log1 }) {
|
|
2089
2126
|
this._swarms = new import_util6.ComplexMap(import_keys8.PublicKey.hash);
|
|
@@ -2313,7 +2350,7 @@ var NetworkManager = class {
|
|
|
2313
2350
|
this.connectionStateChanged.emit(this._connectionState);
|
|
2314
2351
|
}
|
|
2315
2352
|
};
|
|
2316
|
-
var __dxlog_file8 = "/home/
|
|
2353
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/fully-connected-topology.ts";
|
|
2317
2354
|
var FullyConnectedTopology = class {
|
|
2318
2355
|
toString() {
|
|
2319
2356
|
return "FullyConnectedTopology";
|
|
@@ -2351,7 +2388,7 @@ var FullyConnectedTopology = class {
|
|
|
2351
2388
|
async destroy() {
|
|
2352
2389
|
}
|
|
2353
2390
|
};
|
|
2354
|
-
var __dxlog_file9 = "/home/
|
|
2391
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/mmst-topology.ts";
|
|
2355
2392
|
var MMSTTopology = class {
|
|
2356
2393
|
constructor({ originateConnections = 2, maxPeers = 4, sampleSize = 10 } = {}) {
|
|
2357
2394
|
this._sampleCollected = false;
|
|
@@ -2456,7 +2493,7 @@ var MMSTTopology = class {
|
|
|
2456
2493
|
}
|
|
2457
2494
|
};
|
|
2458
2495
|
var sortByXorDistance = (keys, reference) => keys.sort((a, b) => import_xor_distance.default.gt((0, import_xor_distance.default)(a.asBuffer(), reference.asBuffer()), (0, import_xor_distance.default)(b.asBuffer(), reference.asBuffer())));
|
|
2459
|
-
var __dxlog_file10 = "/home/
|
|
2496
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/star-topology.ts";
|
|
2460
2497
|
var StarTopology = class {
|
|
2461
2498
|
constructor(_centralPeer) {
|
|
2462
2499
|
this._centralPeer = _centralPeer;
|
|
@@ -2558,7 +2595,7 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
2558
2595
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2559
2596
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2560
2597
|
}
|
|
2561
|
-
var __dxlog_file11 = "/home/
|
|
2598
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/memory-transport.ts";
|
|
2562
2599
|
var MEMORY_TRANSPORT_DELAY = 1;
|
|
2563
2600
|
var createStreamDelay = (delay) => {
|
|
2564
2601
|
return new import_node_stream.Transform({
|
|
@@ -2740,7 +2777,7 @@ try {
|
|
|
2740
2777
|
wrtc = (0, import_chunk_XE5JOIGD.__require)("@koush/wrtc");
|
|
2741
2778
|
} catch {
|
|
2742
2779
|
}
|
|
2743
|
-
var __dxlog_file12 = "/home/
|
|
2780
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport.ts";
|
|
2744
2781
|
var SimplePeerTransport = class {
|
|
2745
2782
|
constructor(params) {
|
|
2746
2783
|
this.params = params;
|
|
@@ -2808,12 +2845,20 @@ var SimplePeerTransport = class {
|
|
|
2808
2845
|
if (err.errorDetail === "sctp-failure") {
|
|
2809
2846
|
this.errors.raise(new import_protocols7.ConnectionResetError("sctp-failure from RTCError", err));
|
|
2810
2847
|
} else {
|
|
2848
|
+
import_log11.log.info("unknown RTCError", {
|
|
2849
|
+
err
|
|
2850
|
+
}, {
|
|
2851
|
+
F: __dxlog_file12,
|
|
2852
|
+
L: 74,
|
|
2853
|
+
S: this,
|
|
2854
|
+
C: (f, a) => f(...a)
|
|
2855
|
+
});
|
|
2811
2856
|
this.errors.raise(new import_protocols7.UnknownProtocolError("unknown RTCError", err));
|
|
2812
2857
|
}
|
|
2813
2858
|
} else if ("code" in err) {
|
|
2814
2859
|
import_log11.log.info("simple-peer error", err, {
|
|
2815
2860
|
F: __dxlog_file12,
|
|
2816
|
-
L:
|
|
2861
|
+
L: 79,
|
|
2817
2862
|
S: this,
|
|
2818
2863
|
C: (f, a) => f(...a)
|
|
2819
2864
|
});
|
|
@@ -2821,10 +2866,12 @@ var SimplePeerTransport = class {
|
|
|
2821
2866
|
case "ERR_WEBRTC_SUPPORT":
|
|
2822
2867
|
this.errors.raise(new import_protocols7.ProtocolError("WebRTC not supported", err));
|
|
2823
2868
|
break;
|
|
2869
|
+
case "ERR_SIGNALING":
|
|
2870
|
+
this.errors.raise(new import_protocols7.ConnectivityError("signaling failure", err));
|
|
2871
|
+
break;
|
|
2824
2872
|
case "ERR_ICE_CONNECTION_FAILURE":
|
|
2825
2873
|
case "ERR_DATA_CHANNEL":
|
|
2826
2874
|
case "ERR_CONNECTION_FAILURE":
|
|
2827
|
-
case "ERR_SIGNALING":
|
|
2828
2875
|
this.errors.raise(new import_protocols7.ConnectivityError("unknown communication failure", err));
|
|
2829
2876
|
break;
|
|
2830
2877
|
case "ERR_CREATE_OFFER":
|
|
@@ -2841,7 +2888,7 @@ var SimplePeerTransport = class {
|
|
|
2841
2888
|
} else {
|
|
2842
2889
|
import_log11.log.info("unknown peer connection error", err, {
|
|
2843
2890
|
F: __dxlog_file12,
|
|
2844
|
-
L:
|
|
2891
|
+
L: 105,
|
|
2845
2892
|
S: this,
|
|
2846
2893
|
C: (f, a) => f(...a)
|
|
2847
2894
|
});
|
|
@@ -2855,7 +2902,7 @@ var SimplePeerTransport = class {
|
|
|
2855
2902
|
stats
|
|
2856
2903
|
}, {
|
|
2857
2904
|
F: __dxlog_file12,
|
|
2858
|
-
L:
|
|
2905
|
+
L: 113,
|
|
2859
2906
|
S: this,
|
|
2860
2907
|
C: (f, a) => f(...a)
|
|
2861
2908
|
});
|
|
@@ -2864,7 +2911,7 @@ var SimplePeerTransport = class {
|
|
|
2864
2911
|
} catch (err2) {
|
|
2865
2912
|
import_log11.log.catch(err2, void 0, {
|
|
2866
2913
|
F: __dxlog_file12,
|
|
2867
|
-
L:
|
|
2914
|
+
L: 120,
|
|
2868
2915
|
S: this,
|
|
2869
2916
|
C: (f, a) => f(...a)
|
|
2870
2917
|
});
|
|
@@ -2875,7 +2922,7 @@ var SimplePeerTransport = class {
|
|
|
2875
2922
|
id: this._instanceId
|
|
2876
2923
|
}), {
|
|
2877
2924
|
F: __dxlog_file12,
|
|
2878
|
-
L:
|
|
2925
|
+
L: 125,
|
|
2879
2926
|
S: this,
|
|
2880
2927
|
C: (f, a) => f(...a)
|
|
2881
2928
|
});
|
|
@@ -2883,7 +2930,7 @@ var SimplePeerTransport = class {
|
|
|
2883
2930
|
async destroy() {
|
|
2884
2931
|
(0, import_log11.log)("closing...", void 0, {
|
|
2885
2932
|
F: __dxlog_file12,
|
|
2886
|
-
L:
|
|
2933
|
+
L: 129,
|
|
2887
2934
|
S: this,
|
|
2888
2935
|
C: (f, a) => f(...a)
|
|
2889
2936
|
});
|
|
@@ -2896,7 +2943,7 @@ var SimplePeerTransport = class {
|
|
|
2896
2943
|
this.closed.emit();
|
|
2897
2944
|
(0, import_log11.log)("closed", void 0, {
|
|
2898
2945
|
F: __dxlog_file12,
|
|
2899
|
-
L:
|
|
2946
|
+
L: 137,
|
|
2900
2947
|
S: this,
|
|
2901
2948
|
C: (f, a) => f(...a)
|
|
2902
2949
|
});
|
|
@@ -2920,7 +2967,7 @@ var createSimplePeerTransportFactory = (webrtcConfig) => ({
|
|
|
2920
2967
|
webrtcConfig
|
|
2921
2968
|
})
|
|
2922
2969
|
});
|
|
2923
|
-
var __dxlog_file13 = "/home/
|
|
2970
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport-service.ts";
|
|
2924
2971
|
var SimplePeerTransportService = class {
|
|
2925
2972
|
constructor(_webrtcConfig) {
|
|
2926
2973
|
this._webrtcConfig = _webrtcConfig;
|
|
@@ -3051,7 +3098,7 @@ var SimplePeerTransportService = class {
|
|
|
3051
3098
|
});
|
|
3052
3099
|
}
|
|
3053
3100
|
};
|
|
3054
|
-
var __dxlog_file14 = "/home/
|
|
3101
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport-proxy.ts";
|
|
3055
3102
|
var RESP_MIN_THRESHOLD = 500;
|
|
3056
3103
|
var TIMEOUT_THRESHOLD = 10;
|
|
3057
3104
|
var SimplePeerTransportProxy = class {
|
|
@@ -3264,7 +3311,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
3264
3311
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3265
3312
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3266
3313
|
}
|
|
3267
|
-
var __dxlog_file15 = "/home/
|
|
3314
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/libdatachannel-transport.ts";
|
|
3268
3315
|
var DATACHANNEL_LABEL = "dxos.mesh.transport";
|
|
3269
3316
|
var MAX_BUFFERED_AMOUNT = 64 * 1024;
|
|
3270
3317
|
var MAX_MESSAGE_SIZE = 64 * 1024;
|
|
@@ -3417,16 +3464,21 @@ var LibDataChannelTransport = class {
|
|
|
3417
3464
|
const duplex = new import_stream.Duplex({
|
|
3418
3465
|
read: () => {
|
|
3419
3466
|
},
|
|
3420
|
-
write: (chunk, encoding, callback) => {
|
|
3467
|
+
write: async (chunk, encoding, callback) => {
|
|
3421
3468
|
if (chunk.length > MAX_MESSAGE_SIZE) {
|
|
3422
3469
|
this.errors.raise(new Error(`message too large: ${chunk.length} > ${MAX_MESSAGE_SIZE}`));
|
|
3423
3470
|
}
|
|
3424
|
-
|
|
3471
|
+
try {
|
|
3472
|
+
dataChannel.send(chunk);
|
|
3473
|
+
} catch (err) {
|
|
3474
|
+
this.errors.raise(err);
|
|
3475
|
+
await this._close();
|
|
3476
|
+
}
|
|
3425
3477
|
if (this._channel.bufferedAmount > MAX_BUFFERED_AMOUNT) {
|
|
3426
3478
|
if (this._writeCallback !== null) {
|
|
3427
3479
|
import_log14.log.error("consumer trying to write before we're ready for more data", void 0, {
|
|
3428
3480
|
F: __dxlog_file15,
|
|
3429
|
-
L:
|
|
3481
|
+
L: 143,
|
|
3430
3482
|
S: this,
|
|
3431
3483
|
C: (f, a) => f(...a)
|
|
3432
3484
|
});
|
|
@@ -3451,7 +3503,7 @@ var LibDataChannelTransport = class {
|
|
|
3451
3503
|
err
|
|
3452
3504
|
}, {
|
|
3453
3505
|
F: __dxlog_file15,
|
|
3454
|
-
L:
|
|
3506
|
+
L: 163,
|
|
3455
3507
|
S: this,
|
|
3456
3508
|
C: (f, a) => f(...a)
|
|
3457
3509
|
});
|
|
@@ -3488,7 +3540,7 @@ var LibDataChannelTransport = class {
|
|
|
3488
3540
|
peer
|
|
3489
3541
|
}, {
|
|
3490
3542
|
F: __dxlog_file15,
|
|
3491
|
-
L:
|
|
3543
|
+
L: 198,
|
|
3492
3544
|
S: this,
|
|
3493
3545
|
C: (f, a) => f(...a)
|
|
3494
3546
|
});
|
|
@@ -3516,7 +3568,7 @@ var LibDataChannelTransport = class {
|
|
|
3516
3568
|
err
|
|
3517
3569
|
}, {
|
|
3518
3570
|
F: __dxlog_file15,
|
|
3519
|
-
L:
|
|
3571
|
+
L: 209,
|
|
3520
3572
|
S: this,
|
|
3521
3573
|
C: (f, a) => f(...a)
|
|
3522
3574
|
});
|
|
@@ -3536,7 +3588,7 @@ var LibDataChannelTransport = class {
|
|
|
3536
3588
|
err
|
|
3537
3589
|
}, {
|
|
3538
3590
|
F: __dxlog_file15,
|
|
3539
|
-
L:
|
|
3591
|
+
L: 220,
|
|
3540
3592
|
S: this,
|
|
3541
3593
|
C: (f, a) => f(...a)
|
|
3542
3594
|
});
|
|
@@ -3555,7 +3607,7 @@ var LibDataChannelTransport = class {
|
|
|
3555
3607
|
signal
|
|
3556
3608
|
}, {
|
|
3557
3609
|
F: __dxlog_file15,
|
|
3558
|
-
L:
|
|
3610
|
+
L: 231,
|
|
3559
3611
|
S: this,
|
|
3560
3612
|
C: (f, a) => f(...a)
|
|
3561
3613
|
});
|
|
@@ -3564,7 +3616,7 @@ var LibDataChannelTransport = class {
|
|
|
3564
3616
|
}).catch((err) => {
|
|
3565
3617
|
import_log14.log.catch(err, void 0, {
|
|
3566
3618
|
F: __dxlog_file15,
|
|
3567
|
-
L:
|
|
3619
|
+
L: 236,
|
|
3568
3620
|
S: this,
|
|
3569
3621
|
C: (f, a) => f(...a)
|
|
3570
3622
|
});
|
|
@@ -3587,7 +3639,7 @@ var createLibDataChannelTransportFactory = (webrtcConfig) => ({
|
|
|
3587
3639
|
webrtcConfig
|
|
3588
3640
|
})
|
|
3589
3641
|
});
|
|
3590
|
-
var __dxlog_file16 = "/home/
|
|
3642
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/tcp-transport.ts";
|
|
3591
3643
|
var TcpTransportFactory = {
|
|
3592
3644
|
createTransport: (params) => new TcpTransport(params)
|
|
3593
3645
|
};
|
|
@@ -3758,4 +3810,4 @@ var createTeleportProtocolFactory = (onConnection) => {
|
|
|
3758
3810
|
createSimplePeerTransportFactory,
|
|
3759
3811
|
createTeleportProtocolFactory
|
|
3760
3812
|
});
|
|
3761
|
-
//# sourceMappingURL=chunk-
|
|
3813
|
+
//# sourceMappingURL=chunk-6AD7QA4X.cjs.map
|