@dxos/teleport 0.3.4 → 0.3.5-main.0b69ff7
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-J3RZ6SXA.mjs → chunk-PWWDYMDW.mjs} +197 -80
- package/dist/lib/browser/chunk-PWWDYMDW.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/index.cjs +195 -78
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +194 -77
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/muxing/balancer.d.ts.map +1 -1
- package/dist/types/src/muxing/framer.d.ts.map +1 -1
- package/dist/types/src/muxing/muxer.d.ts +4 -5
- package/dist/types/src/muxing/muxer.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/muxing/balancer.ts +3 -0
- package/src/muxing/framer.ts +7 -0
- package/src/muxing/muxer.test.ts +1 -1
- package/src/muxing/muxer.ts +81 -27
- package/src/teleport.ts +1 -1
- package/dist/lib/browser/chunk-J3RZ6SXA.mjs.map +0 -7
|
@@ -42,7 +42,7 @@ module.exports = __toCommonJS(testing_exports);
|
|
|
42
42
|
var import_node_stream3 = require("node:stream");
|
|
43
43
|
var import_invariant4 = require("@dxos/invariant");
|
|
44
44
|
var import_keys2 = require("@dxos/keys");
|
|
45
|
-
var
|
|
45
|
+
var import_log5 = require("@dxos/log");
|
|
46
46
|
|
|
47
47
|
// packages/core/mesh/teleport/src/teleport.ts
|
|
48
48
|
var import_async4 = require("@dxos/async");
|
|
@@ -50,7 +50,7 @@ var import_context2 = require("@dxos/context");
|
|
|
50
50
|
var import_debug2 = require("@dxos/debug");
|
|
51
51
|
var import_invariant3 = require("@dxos/invariant");
|
|
52
52
|
var import_keys = require("@dxos/keys");
|
|
53
|
-
var
|
|
53
|
+
var import_log4 = require("@dxos/log");
|
|
54
54
|
var import_protocols2 = require("@dxos/protocols");
|
|
55
55
|
var import_rpc = require("@dxos/rpc");
|
|
56
56
|
var import_util = require("@dxos/util");
|
|
@@ -59,7 +59,8 @@ var import_util = require("@dxos/util");
|
|
|
59
59
|
var import_node_stream = require("node:stream");
|
|
60
60
|
var import_async = require("@dxos/async");
|
|
61
61
|
var import_invariant = require("@dxos/invariant");
|
|
62
|
-
var
|
|
62
|
+
var import_log = require("@dxos/log");
|
|
63
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/framer.ts";
|
|
63
64
|
var FRAME_LENGTH_SIZE = 2;
|
|
64
65
|
var Framer = class {
|
|
65
66
|
constructor() {
|
|
@@ -81,7 +82,7 @@ var Framer = class {
|
|
|
81
82
|
write: (chunk, encoding, callback) => {
|
|
82
83
|
(0, import_invariant.invariant)(!this._subscribeCb, "Internal Framer bug. Concurrent writes detected.", {
|
|
83
84
|
F: __dxlog_file,
|
|
84
|
-
L:
|
|
85
|
+
L: 40,
|
|
85
86
|
S: this,
|
|
86
87
|
A: [
|
|
87
88
|
"!this._subscribeCb",
|
|
@@ -125,7 +126,7 @@ var Framer = class {
|
|
|
125
126
|
subscribe: (callback) => {
|
|
126
127
|
(0, import_invariant.invariant)(!this._messageCb, "Rpc port already has a message listener.", {
|
|
127
128
|
F: __dxlog_file,
|
|
128
|
-
L:
|
|
129
|
+
L: 79,
|
|
129
130
|
S: this,
|
|
130
131
|
A: [
|
|
131
132
|
"!this._messageCb",
|
|
@@ -179,6 +180,22 @@ var Framer = class {
|
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
182
|
destroy() {
|
|
183
|
+
if (this._stream.readableLength > 0) {
|
|
184
|
+
import_log.log.warn("framer destroyed while there are still read bytes in the buffer.", void 0, {
|
|
185
|
+
F: __dxlog_file,
|
|
186
|
+
L: 140,
|
|
187
|
+
S: this,
|
|
188
|
+
C: (f, a) => f(...a)
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
if (this._stream.writableLength > 0) {
|
|
192
|
+
import_log.log.warn("framer destroyed while there are still write bytes in the buffer.", void 0, {
|
|
193
|
+
F: __dxlog_file,
|
|
194
|
+
L: 143,
|
|
195
|
+
S: this,
|
|
196
|
+
C: (f, a) => f(...a)
|
|
197
|
+
});
|
|
198
|
+
}
|
|
182
199
|
this._stream.destroy();
|
|
183
200
|
}
|
|
184
201
|
};
|
|
@@ -210,14 +227,14 @@ var import_async3 = require("@dxos/async");
|
|
|
210
227
|
var import_context = require("@dxos/context");
|
|
211
228
|
var import_debug = require("@dxos/debug");
|
|
212
229
|
var import_invariant2 = require("@dxos/invariant");
|
|
213
|
-
var
|
|
230
|
+
var import_log3 = require("@dxos/log");
|
|
214
231
|
var import_protocols = require("@dxos/protocols");
|
|
215
232
|
|
|
216
233
|
// packages/core/mesh/teleport/src/muxing/balancer.ts
|
|
217
234
|
var varint = __toESM(require("varint"));
|
|
218
235
|
var import_async2 = require("@dxos/async");
|
|
219
|
-
var
|
|
220
|
-
var __dxlog_file2 = "/
|
|
236
|
+
var import_log2 = require("@dxos/log");
|
|
237
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/balancer.ts";
|
|
221
238
|
var MAX_CHUNK_SIZE = 8192;
|
|
222
239
|
var Balancer = class {
|
|
223
240
|
constructor(_sysChannelId) {
|
|
@@ -269,7 +286,7 @@ var Balancer = class {
|
|
|
269
286
|
});
|
|
270
287
|
});
|
|
271
288
|
if (noCalls) {
|
|
272
|
-
this._sendChunk().catch((err) =>
|
|
289
|
+
this._sendChunk().catch((err) => import_log2.log.catch(err, void 0, {
|
|
273
290
|
F: __dxlog_file2,
|
|
274
291
|
L: 100,
|
|
275
292
|
S: this,
|
|
@@ -278,6 +295,14 @@ var Balancer = class {
|
|
|
278
295
|
}
|
|
279
296
|
}
|
|
280
297
|
destroy() {
|
|
298
|
+
if (this._sendBuffers.size !== 0) {
|
|
299
|
+
import_log2.log.warn("destroying balancer with pending calls", void 0, {
|
|
300
|
+
F: __dxlog_file2,
|
|
301
|
+
L: 106,
|
|
302
|
+
S: this,
|
|
303
|
+
C: (f, a) => f(...a)
|
|
304
|
+
});
|
|
305
|
+
}
|
|
281
306
|
this._sendBuffers.clear();
|
|
282
307
|
this._framer.destroy();
|
|
283
308
|
}
|
|
@@ -374,11 +399,12 @@ var decodeChunk = (data, withLength) => {
|
|
|
374
399
|
};
|
|
375
400
|
|
|
376
401
|
// packages/core/mesh/teleport/src/muxing/muxer.ts
|
|
377
|
-
var __dxlog_file3 = "/
|
|
402
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/muxer.ts";
|
|
378
403
|
var Command = import_protocols.schema.getCodecForType("dxos.mesh.muxer.Command");
|
|
379
404
|
var STATS_INTERVAL = 1e3;
|
|
380
405
|
var MAX_SAFE_FRAME_SIZE = 1e6;
|
|
381
406
|
var SYSTEM_CHANNEL_ID = 0;
|
|
407
|
+
var GRACEFUL_CLOSE_TIMEOUT = 3e3;
|
|
382
408
|
var Muxer = class {
|
|
383
409
|
constructor() {
|
|
384
410
|
this._balancer = new Balancer(SYSTEM_CHANNEL_ID);
|
|
@@ -388,9 +414,10 @@ var Muxer = class {
|
|
|
388
414
|
this._nextId = 1;
|
|
389
415
|
this._destroyed = false;
|
|
390
416
|
this._destroying = false;
|
|
417
|
+
this._closing = false;
|
|
391
418
|
this._lastStats = void 0;
|
|
392
419
|
this._lastChannelStats = /* @__PURE__ */ new Map();
|
|
393
|
-
this.
|
|
420
|
+
this.afterClosed = new import_async3.Event();
|
|
394
421
|
this.statsUpdated = new import_async3.Event();
|
|
395
422
|
this.stream = this._balancer.stream;
|
|
396
423
|
this._balancer.incomingData.on(async (msg) => {
|
|
@@ -411,7 +438,7 @@ var Muxer = class {
|
|
|
411
438
|
});
|
|
412
439
|
(0, import_invariant2.invariant)(!channel.push, `Channel already open: ${tag}`, {
|
|
413
440
|
F: __dxlog_file3,
|
|
414
|
-
L:
|
|
441
|
+
L: 138,
|
|
415
442
|
S: this,
|
|
416
443
|
A: [
|
|
417
444
|
"!channel.push",
|
|
@@ -459,7 +486,7 @@ var Muxer = class {
|
|
|
459
486
|
});
|
|
460
487
|
(0, import_invariant2.invariant)(!channel.push, `Channel already open: ${tag}`, {
|
|
461
488
|
F: __dxlog_file3,
|
|
462
|
-
L:
|
|
489
|
+
L: 190,
|
|
463
490
|
S: this,
|
|
464
491
|
A: [
|
|
465
492
|
"!channel.push",
|
|
@@ -483,7 +510,7 @@ var Muxer = class {
|
|
|
483
510
|
subscribe: (cb) => {
|
|
484
511
|
(0, import_invariant2.invariant)(!callback, "Only one subscriber is allowed", {
|
|
485
512
|
F: __dxlog_file3,
|
|
486
|
-
L:
|
|
513
|
+
L: 212,
|
|
487
514
|
S: this,
|
|
488
515
|
A: [
|
|
489
516
|
"!callback",
|
|
@@ -511,61 +538,153 @@ var Muxer = class {
|
|
|
511
538
|
}
|
|
512
539
|
return port;
|
|
513
540
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
*/
|
|
517
|
-
async destroy(err) {
|
|
541
|
+
// initiate graceful close
|
|
542
|
+
async close(err) {
|
|
518
543
|
if (this._destroying) {
|
|
544
|
+
(0, import_log3.log)("already destroying, ignoring graceful close request", void 0, {
|
|
545
|
+
F: __dxlog_file3,
|
|
546
|
+
L: 245,
|
|
547
|
+
S: this,
|
|
548
|
+
C: (f, a) => f(...a)
|
|
549
|
+
});
|
|
519
550
|
return;
|
|
520
551
|
}
|
|
521
|
-
this.
|
|
522
|
-
|
|
523
|
-
|
|
552
|
+
if (this._closing) {
|
|
553
|
+
(0, import_log3.log)("already closing, ignoring graceful close request", void 0, {
|
|
554
|
+
F: __dxlog_file3,
|
|
555
|
+
L: 249,
|
|
556
|
+
S: this,
|
|
557
|
+
C: (f, a) => f(...a)
|
|
558
|
+
});
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
this._closing = true;
|
|
562
|
+
await this._sendCommand({
|
|
563
|
+
close: {
|
|
524
564
|
error: err?.message
|
|
525
565
|
}
|
|
526
|
-
}, SYSTEM_CHANNEL_ID).
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
566
|
+
}, SYSTEM_CHANNEL_ID).catch(async (err2) => {
|
|
567
|
+
(0, import_log3.log)("error sending close command", {
|
|
568
|
+
err: err2
|
|
569
|
+
}, {
|
|
570
|
+
F: __dxlog_file3,
|
|
571
|
+
L: 263,
|
|
572
|
+
S: this,
|
|
573
|
+
C: (f, a) => f(...a)
|
|
574
|
+
});
|
|
575
|
+
await this.dispose(err2);
|
|
530
576
|
});
|
|
577
|
+
await Promise.race([
|
|
578
|
+
new Promise((_resolve, reject) => {
|
|
579
|
+
setTimeout(() => {
|
|
580
|
+
reject(new import_protocols.TimeoutError("gracefully closing muxer"));
|
|
581
|
+
}, GRACEFUL_CLOSE_TIMEOUT);
|
|
582
|
+
}),
|
|
583
|
+
(async () => {
|
|
584
|
+
await this.dispose(err);
|
|
585
|
+
})()
|
|
586
|
+
]);
|
|
587
|
+
}
|
|
588
|
+
// force close without confirmation
|
|
589
|
+
async destroy(err) {
|
|
590
|
+
if (this._destroying) {
|
|
591
|
+
(0, import_log3.log)("already destroying, ignoring destroy request", void 0, {
|
|
592
|
+
F: __dxlog_file3,
|
|
593
|
+
L: 284,
|
|
594
|
+
S: this,
|
|
595
|
+
C: (f, a) => f(...a)
|
|
596
|
+
});
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
this._destroying = true;
|
|
531
600
|
void this._ctx.dispose();
|
|
601
|
+
if (this._closing) {
|
|
602
|
+
(0, import_log3.log)("destroy cancelling graceful close", void 0, {
|
|
603
|
+
F: __dxlog_file3,
|
|
604
|
+
L: 290,
|
|
605
|
+
S: this,
|
|
606
|
+
C: (f, a) => f(...a)
|
|
607
|
+
});
|
|
608
|
+
this._closing = false;
|
|
609
|
+
} else {
|
|
610
|
+
await this._sendCommand({
|
|
611
|
+
close: {
|
|
612
|
+
error: err?.message
|
|
613
|
+
}
|
|
614
|
+
}, SYSTEM_CHANNEL_ID).catch(async (err2) => {
|
|
615
|
+
(0, import_log3.log)("error sending courtesy close command", {
|
|
616
|
+
err: err2
|
|
617
|
+
}, {
|
|
618
|
+
F: __dxlog_file3,
|
|
619
|
+
L: 303,
|
|
620
|
+
S: this,
|
|
621
|
+
C: (f, a) => f(...a)
|
|
622
|
+
});
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
this.dispose(err).catch((err2) => {
|
|
626
|
+
(0, import_log3.log)("error disposing after destroy", {
|
|
627
|
+
err: err2
|
|
628
|
+
}, {
|
|
629
|
+
F: __dxlog_file3,
|
|
630
|
+
L: 308,
|
|
631
|
+
S: this,
|
|
632
|
+
C: (f, a) => f(...a)
|
|
633
|
+
});
|
|
634
|
+
});
|
|
532
635
|
}
|
|
533
|
-
|
|
636
|
+
// complete the termination, graceful or otherwise
|
|
637
|
+
async dispose(err) {
|
|
534
638
|
if (this._destroyed) {
|
|
639
|
+
(0, import_log3.log)("already destroyed, ignoring dispose request", void 0, {
|
|
640
|
+
F: __dxlog_file3,
|
|
641
|
+
L: 316,
|
|
642
|
+
S: this,
|
|
643
|
+
C: (f, a) => f(...a)
|
|
644
|
+
});
|
|
535
645
|
return;
|
|
536
646
|
}
|
|
537
|
-
this.
|
|
538
|
-
this._balancer.destroy();
|
|
647
|
+
void this._ctx.dispose();
|
|
648
|
+
await this._balancer.destroy();
|
|
539
649
|
for (const channel of this._channelsByTag.values()) {
|
|
540
650
|
channel.destroy?.(err);
|
|
541
651
|
}
|
|
542
|
-
this.
|
|
652
|
+
this._destroyed = true;
|
|
653
|
+
this.afterClosed.emit(err);
|
|
543
654
|
this._channelsByLocalId.clear();
|
|
544
655
|
this._channelsByTag.clear();
|
|
545
656
|
}
|
|
546
657
|
async _handleCommand(cmd) {
|
|
547
|
-
(
|
|
548
|
-
|
|
549
|
-
}, {
|
|
550
|
-
F: __dxlog_file3,
|
|
551
|
-
L: 286,
|
|
552
|
-
S: this,
|
|
553
|
-
C: (f, a) => f(...a)
|
|
554
|
-
});
|
|
555
|
-
if (this._destroyed || this._destroying) {
|
|
556
|
-
if (cmd.destroy) {
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
import_log2.log.warn("Received command after destroy", {
|
|
658
|
+
if (this._destroyed) {
|
|
659
|
+
import_log3.log.warn("Received command after destroy", {
|
|
560
660
|
cmd
|
|
561
661
|
}, {
|
|
562
662
|
F: __dxlog_file3,
|
|
563
|
-
L:
|
|
663
|
+
L: 338,
|
|
564
664
|
S: this,
|
|
565
665
|
C: (f, a) => f(...a)
|
|
566
666
|
});
|
|
567
667
|
return;
|
|
568
668
|
}
|
|
669
|
+
if (cmd.close) {
|
|
670
|
+
if (!this._closing) {
|
|
671
|
+
(0, import_log3.log)("received peer close, initiating my own graceful close", void 0, {
|
|
672
|
+
F: __dxlog_file3,
|
|
673
|
+
L: 344,
|
|
674
|
+
S: this,
|
|
675
|
+
C: (f, a) => f(...a)
|
|
676
|
+
});
|
|
677
|
+
await this.close();
|
|
678
|
+
} else {
|
|
679
|
+
(0, import_log3.log)("received close from peer, already closing", void 0, {
|
|
680
|
+
F: __dxlog_file3,
|
|
681
|
+
L: 347,
|
|
682
|
+
S: this,
|
|
683
|
+
C: (f, a) => f(...a)
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
569
688
|
if (cmd.openChannel) {
|
|
570
689
|
const channel = this._getOrCreateStream({
|
|
571
690
|
tag: cmd.openChannel.tag,
|
|
@@ -584,19 +703,17 @@ var Muxer = class {
|
|
|
584
703
|
} else if (cmd.data) {
|
|
585
704
|
const stream = this._channelsByLocalId.get(cmd.data.channelId) ?? (0, import_debug.failUndefined)();
|
|
586
705
|
if (!stream.push) {
|
|
587
|
-
|
|
706
|
+
import_log3.log.warn("Received data for channel before it was opened", {
|
|
588
707
|
tag: stream.tag
|
|
589
708
|
}, {
|
|
590
709
|
F: __dxlog_file3,
|
|
591
|
-
L:
|
|
710
|
+
L: 376,
|
|
592
711
|
S: this,
|
|
593
712
|
C: (f, a) => f(...a)
|
|
594
713
|
});
|
|
595
714
|
return;
|
|
596
715
|
}
|
|
597
716
|
stream.push(cmd.data.data);
|
|
598
|
-
} else if (cmd.destroy) {
|
|
599
|
-
this._dispose();
|
|
600
717
|
}
|
|
601
718
|
}
|
|
602
719
|
async _sendCommand(cmd, channelId = -1) {
|
|
@@ -632,12 +749,12 @@ var Muxer = class {
|
|
|
632
749
|
}
|
|
633
750
|
async _sendData(channel, data) {
|
|
634
751
|
if (data.length > MAX_SAFE_FRAME_SIZE) {
|
|
635
|
-
|
|
752
|
+
import_log3.log.warn("frame size exceeds maximum safe value", {
|
|
636
753
|
size: data.length,
|
|
637
754
|
threshold: MAX_SAFE_FRAME_SIZE
|
|
638
755
|
}, {
|
|
639
756
|
F: __dxlog_file3,
|
|
640
|
-
L:
|
|
757
|
+
L: 419,
|
|
641
758
|
S: this,
|
|
642
759
|
C: (f, a) => f(...a)
|
|
643
760
|
});
|
|
@@ -714,13 +831,13 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
714
831
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
715
832
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
716
833
|
}
|
|
717
|
-
var __dxlog_file4 = "/
|
|
834
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/teleport.ts";
|
|
718
835
|
var Teleport = class {
|
|
719
836
|
constructor({ initiator, localPeerId, remotePeerId }) {
|
|
720
837
|
this._ctx = new import_context2.Context({
|
|
721
838
|
onError: (err) => {
|
|
722
839
|
void this.destroy(err).catch(() => {
|
|
723
|
-
|
|
840
|
+
import_log4.log.error("Error during destroy", err, {
|
|
724
841
|
F: __dxlog_file4,
|
|
725
842
|
L: 44,
|
|
726
843
|
S: this,
|
|
@@ -737,13 +854,13 @@ var Teleport = class {
|
|
|
737
854
|
if (this._destroying || this._aborting) {
|
|
738
855
|
return;
|
|
739
856
|
}
|
|
740
|
-
(0,
|
|
857
|
+
(0, import_log4.log)("destroy teleport due to onTimeout in ControlExtension", void 0, {
|
|
741
858
|
F: __dxlog_file4,
|
|
742
859
|
L: 59,
|
|
743
860
|
S: this,
|
|
744
861
|
C: (f, a) => f(...a)
|
|
745
862
|
});
|
|
746
|
-
this.destroy(new import_protocols2.TimeoutError("control extension")).catch((err) =>
|
|
863
|
+
this.destroy(new import_protocols2.TimeoutError("control extension")).catch((err) => import_log4.log.catch(err, void 0, {
|
|
747
864
|
F: __dxlog_file4,
|
|
748
865
|
L: 60,
|
|
749
866
|
S: this,
|
|
@@ -787,7 +904,7 @@ var Teleport = class {
|
|
|
787
904
|
this.localPeerId = localPeerId;
|
|
788
905
|
this.remotePeerId = remotePeerId;
|
|
789
906
|
this._control.onExtensionRegistered.set(async (name) => {
|
|
790
|
-
(0,
|
|
907
|
+
(0, import_log4.log)("remote extension", {
|
|
791
908
|
name
|
|
792
909
|
}, {
|
|
793
910
|
F: __dxlog_file4,
|
|
@@ -816,7 +933,7 @@ var Teleport = class {
|
|
|
816
933
|
{
|
|
817
934
|
this._muxer.stream.on("close", async () => {
|
|
818
935
|
if (this._destroying || this._aborting) {
|
|
819
|
-
(0,
|
|
936
|
+
(0, import_log4.log)("destroy teleport due to muxer stream close, skipping due to already destroying/aborting", void 0, {
|
|
820
937
|
F: __dxlog_file4,
|
|
821
938
|
L: 97,
|
|
822
939
|
S: this,
|
|
@@ -831,7 +948,7 @@ var Teleport = class {
|
|
|
831
948
|
});
|
|
832
949
|
}
|
|
833
950
|
this._muxer.statsUpdated.on((stats) => {
|
|
834
|
-
|
|
951
|
+
import_log4.log.trace("dxos.mesh.teleport.stats", {
|
|
835
952
|
localPeerId,
|
|
836
953
|
remotePeerId,
|
|
837
954
|
bytesSent: stats.bytesSent,
|
|
@@ -877,7 +994,7 @@ var Teleport = class {
|
|
|
877
994
|
try {
|
|
878
995
|
await extension.onAbort(err);
|
|
879
996
|
} catch (err2) {
|
|
880
|
-
|
|
997
|
+
import_log4.log.catch(err2, void 0, {
|
|
881
998
|
F: __dxlog_file4,
|
|
882
999
|
L: 163,
|
|
883
1000
|
S: this,
|
|
@@ -900,7 +1017,7 @@ var Teleport = class {
|
|
|
900
1017
|
try {
|
|
901
1018
|
await extension.onClose(err);
|
|
902
1019
|
} catch (err2) {
|
|
903
|
-
|
|
1020
|
+
import_log4.log.catch(err2, void 0, {
|
|
904
1021
|
F: __dxlog_file4,
|
|
905
1022
|
L: 187,
|
|
906
1023
|
S: this,
|
|
@@ -908,13 +1025,13 @@ var Teleport = class {
|
|
|
908
1025
|
});
|
|
909
1026
|
}
|
|
910
1027
|
}
|
|
911
|
-
await this._muxer.
|
|
1028
|
+
await this._muxer.close();
|
|
912
1029
|
}
|
|
913
1030
|
addExtension(name, extension) {
|
|
914
1031
|
if (!this._open) {
|
|
915
1032
|
throw new Error("Not open");
|
|
916
1033
|
}
|
|
917
|
-
(0,
|
|
1034
|
+
(0, import_log4.log)("addExtension", {
|
|
918
1035
|
name
|
|
919
1036
|
}, {
|
|
920
1037
|
F: __dxlog_file4,
|
|
@@ -961,7 +1078,7 @@ var Teleport = class {
|
|
|
961
1078
|
this._extensions.set(extensionName, extension);
|
|
962
1079
|
}
|
|
963
1080
|
async _openExtension(extensionName) {
|
|
964
|
-
(0,
|
|
1081
|
+
(0, import_log4.log)("open extension", {
|
|
965
1082
|
extensionName
|
|
966
1083
|
}, {
|
|
967
1084
|
F: __dxlog_file4,
|
|
@@ -1005,7 +1122,7 @@ var Teleport = class {
|
|
|
1005
1122
|
}
|
|
1006
1123
|
};
|
|
1007
1124
|
await extension.onOpen(context);
|
|
1008
|
-
(0,
|
|
1125
|
+
(0, import_log4.log)("extension opened", {
|
|
1009
1126
|
extensionName
|
|
1010
1127
|
}, {
|
|
1011
1128
|
F: __dxlog_file4,
|
|
@@ -1078,7 +1195,7 @@ var ControlExtension = class {
|
|
|
1078
1195
|
};
|
|
1079
1196
|
|
|
1080
1197
|
// packages/core/mesh/teleport/src/testing/test-builder.ts
|
|
1081
|
-
var __dxlog_file5 = "/
|
|
1198
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/testing/test-builder.ts";
|
|
1082
1199
|
var TestBuilder = class {
|
|
1083
1200
|
constructor() {
|
|
1084
1201
|
this._peers = /* @__PURE__ */ new Set();
|
|
@@ -1246,7 +1363,7 @@ var TestPeer = class {
|
|
|
1246
1363
|
var pipeStreams = (stream1, stream2) => {
|
|
1247
1364
|
(0, import_node_stream3.pipeline)(stream1, stream2, (err) => {
|
|
1248
1365
|
if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
|
|
1249
|
-
|
|
1366
|
+
import_log5.log.catch(err, void 0, {
|
|
1250
1367
|
F: __dxlog_file5,
|
|
1251
1368
|
L: 106,
|
|
1252
1369
|
S: void 0,
|
|
@@ -1256,7 +1373,7 @@ var pipeStreams = (stream1, stream2) => {
|
|
|
1256
1373
|
});
|
|
1257
1374
|
(0, import_node_stream3.pipeline)(stream2, stream1, (err) => {
|
|
1258
1375
|
if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
|
|
1259
|
-
|
|
1376
|
+
import_log5.log.catch(err, void 0, {
|
|
1260
1377
|
F: __dxlog_file5,
|
|
1261
1378
|
L: 111,
|
|
1262
1379
|
S: void 0,
|
|
@@ -1281,10 +1398,10 @@ var TestConnection = class {
|
|
|
1281
1398
|
// packages/core/mesh/teleport/src/testing/test-extension.ts
|
|
1282
1399
|
var import_async5 = require("@dxos/async");
|
|
1283
1400
|
var import_invariant5 = require("@dxos/invariant");
|
|
1284
|
-
var
|
|
1401
|
+
var import_log6 = require("@dxos/log");
|
|
1285
1402
|
var import_protocols3 = require("@dxos/protocols");
|
|
1286
1403
|
var import_rpc2 = require("@dxos/rpc");
|
|
1287
|
-
var __dxlog_file6 = "/
|
|
1404
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/testing/test-extension.ts";
|
|
1288
1405
|
var TestExtension = class {
|
|
1289
1406
|
constructor(callbacks = {}) {
|
|
1290
1407
|
this.callbacks = callbacks;
|
|
@@ -1296,7 +1413,7 @@ var TestExtension = class {
|
|
|
1296
1413
|
return this.extensionContext?.remotePeerId;
|
|
1297
1414
|
}
|
|
1298
1415
|
async onOpen(context) {
|
|
1299
|
-
(0,
|
|
1416
|
+
(0, import_log6.log)("onOpen", {
|
|
1300
1417
|
localPeerId: context.localPeerId,
|
|
1301
1418
|
remotePeerId: context.remotePeerId
|
|
1302
1419
|
}, {
|
|
@@ -1334,7 +1451,7 @@ var TestExtension = class {
|
|
|
1334
1451
|
this.open.wake();
|
|
1335
1452
|
}
|
|
1336
1453
|
async onClose(err) {
|
|
1337
|
-
(0,
|
|
1454
|
+
(0, import_log6.log)("onClose", {
|
|
1338
1455
|
err
|
|
1339
1456
|
}, {
|
|
1340
1457
|
F: __dxlog_file6,
|
|
@@ -1347,7 +1464,7 @@ var TestExtension = class {
|
|
|
1347
1464
|
await this._rpc?.close();
|
|
1348
1465
|
}
|
|
1349
1466
|
async onAbort(err) {
|
|
1350
|
-
(0,
|
|
1467
|
+
(0, import_log6.log)("onAbort", {
|
|
1351
1468
|
err
|
|
1352
1469
|
}, {
|
|
1353
1470
|
F: __dxlog_file6,
|
|
@@ -1388,10 +1505,10 @@ var TestExtension = class {
|
|
|
1388
1505
|
var import_node_crypto = require("node:crypto");
|
|
1389
1506
|
var import_async6 = require("@dxos/async");
|
|
1390
1507
|
var import_invariant6 = require("@dxos/invariant");
|
|
1391
|
-
var
|
|
1508
|
+
var import_log7 = require("@dxos/log");
|
|
1392
1509
|
var import_protocols4 = require("@dxos/protocols");
|
|
1393
1510
|
var import_rpc3 = require("@dxos/rpc");
|
|
1394
|
-
var __dxlog_file7 = "/
|
|
1511
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/testing/test-extension-with-streams.ts";
|
|
1395
1512
|
var TestExtensionWithStreams = class {
|
|
1396
1513
|
constructor(callbacks = {}) {
|
|
1397
1514
|
this.callbacks = callbacks;
|
|
@@ -1453,7 +1570,7 @@ var TestExtensionWithStreams = class {
|
|
|
1453
1570
|
});
|
|
1454
1571
|
streamEntry.reportingTimer = setInterval(() => {
|
|
1455
1572
|
const { bytesSent, bytesReceived, sendErrors, receiveErrors } = streamEntry;
|
|
1456
|
-
|
|
1573
|
+
import_log7.log.trace("dxos.test.stream-stats", {
|
|
1457
1574
|
streamTag,
|
|
1458
1575
|
bytesSent,
|
|
1459
1576
|
bytesReceived,
|
|
@@ -1494,7 +1611,7 @@ var TestExtensionWithStreams = class {
|
|
|
1494
1611
|
};
|
|
1495
1612
|
}
|
|
1496
1613
|
async onOpen(context) {
|
|
1497
|
-
(0,
|
|
1614
|
+
(0, import_log7.log)("onOpen", {
|
|
1498
1615
|
localPeerId: context.localPeerId,
|
|
1499
1616
|
remotePeerId: context.remotePeerId
|
|
1500
1617
|
}, {
|
|
@@ -1544,7 +1661,7 @@ var TestExtensionWithStreams = class {
|
|
|
1544
1661
|
this.open.wake();
|
|
1545
1662
|
}
|
|
1546
1663
|
async onClose(err) {
|
|
1547
|
-
(0,
|
|
1664
|
+
(0, import_log7.log)("onClose", {
|
|
1548
1665
|
err
|
|
1549
1666
|
}, {
|
|
1550
1667
|
F: __dxlog_file7,
|
|
@@ -1555,7 +1672,7 @@ var TestExtensionWithStreams = class {
|
|
|
1555
1672
|
await this.callbacks.onClose?.();
|
|
1556
1673
|
this.closed.wake();
|
|
1557
1674
|
for (const [streamTag, stream] of Object.entries(this._streams)) {
|
|
1558
|
-
(0,
|
|
1675
|
+
(0, import_log7.log)("closing stream", {
|
|
1559
1676
|
streamTag
|
|
1560
1677
|
}, {
|
|
1561
1678
|
F: __dxlog_file7,
|
|
@@ -1569,7 +1686,7 @@ var TestExtensionWithStreams = class {
|
|
|
1569
1686
|
await this._rpc?.close();
|
|
1570
1687
|
}
|
|
1571
1688
|
async onAbort(err) {
|
|
1572
|
-
(0,
|
|
1689
|
+
(0, import_log7.log)("onAbort", {
|
|
1573
1690
|
err
|
|
1574
1691
|
}, {
|
|
1575
1692
|
F: __dxlog_file7,
|