@dxos/network-manager 0.1.53-main.55faa2f → 0.1.53-main.5bcfb84
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-SA5ALANV.mjs → chunk-N5RZB7V4.mjs} +451 -439
- package/dist/lib/browser/{chunk-SA5ALANV.mjs.map → chunk-N5RZB7V4.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +10 -9
- package/dist/lib/browser/testing/index.mjs.map +1 -1
- package/dist/lib/node/index.cjs +450 -438
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +413 -402
- package/dist/lib/node/testing/index.cjs.map +2 -2
- package/package.json +18 -18
package/dist/lib/node/index.cjs
CHANGED
|
@@ -67,7 +67,7 @@ var import_errors = require("@dxos/errors");
|
|
|
67
67
|
var import_keys = require("@dxos/keys");
|
|
68
68
|
var import_log = require("@dxos/log");
|
|
69
69
|
var import_protocols = require("@dxos/protocols");
|
|
70
|
-
|
|
70
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
71
71
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
72
72
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
73
73
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -76,7 +76,8 @@ var __decorate = function(decorators, target, key, desc) {
|
|
|
76
76
|
if (d = decorators[i])
|
|
77
77
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
78
78
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
79
|
-
}
|
|
79
|
+
}
|
|
80
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection.ts";
|
|
80
81
|
var STARTING_SIGNALLING_DELAY = 10;
|
|
81
82
|
var MAX_SIGNALLING_DELAY = 300;
|
|
82
83
|
var ConnectionState;
|
|
@@ -153,21 +154,21 @@ var Connection = class {
|
|
|
153
154
|
import_log.log.trace("dxos.mesh.connection.open-connection", import_protocols.trace.begin({
|
|
154
155
|
id: this._instanceId
|
|
155
156
|
}), {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
F: __dxlog_file,
|
|
158
|
+
L: 115,
|
|
159
|
+
S: this,
|
|
160
|
+
C: (f, a) => f(...a)
|
|
160
161
|
});
|
|
161
162
|
this._changeState(ConnectionState.CONNECTING);
|
|
162
163
|
this._protocol.initialize().catch((err) => {
|
|
163
164
|
this.errors.raise(err);
|
|
164
165
|
});
|
|
165
166
|
this._protocol.stream.on("close", () => {
|
|
166
|
-
(0, import_log.log)("protocol stream closed",
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
(0, import_log.log)("protocol stream closed", void 0, {
|
|
168
|
+
F: __dxlog_file,
|
|
169
|
+
L: 126,
|
|
170
|
+
S: this,
|
|
171
|
+
C: (f, a) => f(...a)
|
|
171
172
|
});
|
|
172
173
|
this.close().catch((err) => this.errors.raise(err));
|
|
173
174
|
});
|
|
@@ -196,10 +197,10 @@ var Connection = class {
|
|
|
196
197
|
import_log.log.trace("dxos.mesh.connection.open-connection", import_protocols.trace.end({
|
|
197
198
|
id: this._instanceId
|
|
198
199
|
}), {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
200
|
+
F: __dxlog_file,
|
|
201
|
+
L: 159,
|
|
202
|
+
S: this,
|
|
203
|
+
C: (f, a) => f(...a)
|
|
203
204
|
});
|
|
204
205
|
}
|
|
205
206
|
async close() {
|
|
@@ -212,38 +213,38 @@ var Connection = class {
|
|
|
212
213
|
(0, import_log.log)("closing...", {
|
|
213
214
|
peerId: this.ownId
|
|
214
215
|
}, {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
F: __dxlog_file,
|
|
217
|
+
L: 171,
|
|
218
|
+
S: this,
|
|
219
|
+
C: (f, a) => f(...a)
|
|
219
220
|
});
|
|
220
221
|
try {
|
|
221
222
|
await this._protocol.destroy();
|
|
222
223
|
} catch (err) {
|
|
223
|
-
import_log.log.catch(err,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
224
|
+
import_log.log.catch(err, void 0, {
|
|
225
|
+
F: __dxlog_file,
|
|
226
|
+
L: 177,
|
|
227
|
+
S: this,
|
|
228
|
+
C: (f, a) => f(...a)
|
|
228
229
|
});
|
|
229
230
|
}
|
|
230
231
|
try {
|
|
231
232
|
await ((_a = this._transport) == null ? void 0 : _a.destroy());
|
|
232
|
-
} catch (
|
|
233
|
-
import_log.log.catch(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
233
|
+
} catch (err) {
|
|
234
|
+
import_log.log.catch(err, void 0, {
|
|
235
|
+
F: __dxlog_file,
|
|
236
|
+
L: 184,
|
|
237
|
+
S: this,
|
|
238
|
+
C: (f, a) => f(...a)
|
|
238
239
|
});
|
|
239
240
|
}
|
|
240
241
|
(0, import_log.log)("closed", {
|
|
241
242
|
peerId: this.ownId
|
|
242
243
|
}, {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
F: __dxlog_file,
|
|
245
|
+
L: 187,
|
|
246
|
+
S: this,
|
|
247
|
+
C: (f, a) => f(...a)
|
|
247
248
|
});
|
|
248
249
|
this._changeState(ConnectionState.CLOSED);
|
|
249
250
|
}
|
|
@@ -280,10 +281,10 @@ var Connection = class {
|
|
|
280
281
|
import_log.log.warn("Signal failed", {
|
|
281
282
|
err
|
|
282
283
|
}, {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
284
|
+
F: __dxlog_file,
|
|
285
|
+
L: 221,
|
|
286
|
+
S: this,
|
|
287
|
+
C: (f, a) => f(...a)
|
|
287
288
|
});
|
|
288
289
|
await this.close();
|
|
289
290
|
}
|
|
@@ -295,11 +296,11 @@ var Connection = class {
|
|
|
295
296
|
var _a, _b, _c;
|
|
296
297
|
(0, import_tiny_invariant.default)(msg.sessionId);
|
|
297
298
|
if (!msg.sessionId.equals(this.sessionId)) {
|
|
298
|
-
(0, import_log.log)("dropping signal for incorrect session id",
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
299
|
+
(0, import_log.log)("dropping signal for incorrect session id", void 0, {
|
|
300
|
+
F: __dxlog_file,
|
|
301
|
+
L: 232,
|
|
302
|
+
S: this,
|
|
303
|
+
C: (f, a) => f(...a)
|
|
303
304
|
});
|
|
304
305
|
return;
|
|
305
306
|
}
|
|
@@ -319,10 +320,10 @@ var Connection = class {
|
|
|
319
320
|
remoteId: this.remoteId,
|
|
320
321
|
msg: msg.data
|
|
321
322
|
}, {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
323
|
+
F: __dxlog_file,
|
|
324
|
+
L: 246,
|
|
325
|
+
S: this,
|
|
326
|
+
C: (f, a) => f(...a)
|
|
326
327
|
});
|
|
327
328
|
this._incomingSignalBuffer.push(signal);
|
|
328
329
|
} else {
|
|
@@ -332,10 +333,10 @@ var Connection = class {
|
|
|
332
333
|
remoteId: this.remoteId,
|
|
333
334
|
msg: msg.data
|
|
334
335
|
}, {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
336
|
+
F: __dxlog_file,
|
|
337
|
+
L: 250,
|
|
338
|
+
S: this,
|
|
339
|
+
C: (f, a) => f(...a)
|
|
339
340
|
});
|
|
340
341
|
await this._transport.signal(signal);
|
|
341
342
|
}
|
|
@@ -347,17 +348,17 @@ var Connection = class {
|
|
|
347
348
|
too: state,
|
|
348
349
|
peerId: this.ownId
|
|
349
350
|
}, {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
351
|
+
F: __dxlog_file,
|
|
352
|
+
L: 257,
|
|
353
|
+
S: this,
|
|
354
|
+
C: (f, a) => f(...a)
|
|
354
355
|
});
|
|
355
356
|
(0, import_tiny_invariant.default)(state !== this._state, "Already in this state.");
|
|
356
357
|
this._state = state;
|
|
357
358
|
this.stateChanged.emit(state);
|
|
358
359
|
}
|
|
359
360
|
};
|
|
360
|
-
|
|
361
|
+
_ts_decorate([
|
|
361
362
|
import_async.synchronized
|
|
362
363
|
], Connection.prototype, "close", null);
|
|
363
364
|
|
|
@@ -378,6 +379,7 @@ var import_keys2 = require("@dxos/keys");
|
|
|
378
379
|
var import_log2 = require("@dxos/log");
|
|
379
380
|
var import_protocols2 = require("@dxos/protocols");
|
|
380
381
|
var import_util = require("@dxos/util");
|
|
382
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/signal/swarm-messenger.ts";
|
|
381
383
|
var SwarmMessenger = class {
|
|
382
384
|
constructor({ sendMessage, onSignal, onOffer, topic }) {
|
|
383
385
|
this._ctx = new import_context2.Context();
|
|
@@ -401,10 +403,10 @@ var SwarmMessenger = class {
|
|
|
401
403
|
to: recipient,
|
|
402
404
|
msg: message
|
|
403
405
|
}, {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
406
|
+
F: __dxlog_file2,
|
|
407
|
+
L: 68,
|
|
408
|
+
S: this,
|
|
409
|
+
C: (f, a) => f(...a)
|
|
408
410
|
});
|
|
409
411
|
if ((_a = message.data) == null ? void 0 : _a.offer) {
|
|
410
412
|
await this._handleOffer({
|
|
@@ -430,10 +432,10 @@ var SwarmMessenger = class {
|
|
|
430
432
|
import_log2.log.warn("unknown message", {
|
|
431
433
|
message
|
|
432
434
|
}, {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
435
|
+
F: __dxlog_file2,
|
|
436
|
+
L: 79,
|
|
437
|
+
S: this,
|
|
438
|
+
C: (f, a) => f(...a)
|
|
437
439
|
});
|
|
438
440
|
}
|
|
439
441
|
}
|
|
@@ -474,10 +476,10 @@ var SwarmMessenger = class {
|
|
|
474
476
|
to: recipient,
|
|
475
477
|
msg: networkMessage
|
|
476
478
|
}, {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
479
|
+
F: __dxlog_file2,
|
|
480
|
+
L: 122,
|
|
481
|
+
S: this,
|
|
482
|
+
C: (f, a) => f(...a)
|
|
481
483
|
});
|
|
482
484
|
await this._sendMessage({
|
|
483
485
|
author,
|
|
@@ -498,10 +500,10 @@ var SwarmMessenger = class {
|
|
|
498
500
|
(0, import_log2.log)("resolving", {
|
|
499
501
|
answer: message.data.answer
|
|
500
502
|
}, {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
503
|
+
F: __dxlog_file2,
|
|
504
|
+
L: 139,
|
|
505
|
+
S: this,
|
|
506
|
+
C: (f, a) => f(...a)
|
|
505
507
|
});
|
|
506
508
|
offerRecord.resolve(message.data.answer);
|
|
507
509
|
}
|
|
@@ -534,10 +536,10 @@ var SwarmMessenger = class {
|
|
|
534
536
|
import_log2.log.warn("error sending answer", {
|
|
535
537
|
err
|
|
536
538
|
}, {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
539
|
+
F: __dxlog_file2,
|
|
540
|
+
L: 173,
|
|
541
|
+
S: this,
|
|
542
|
+
C: (f, a) => f(...a)
|
|
541
543
|
});
|
|
542
544
|
}
|
|
543
545
|
}
|
|
@@ -563,7 +565,7 @@ var import_async2 = require("@dxos/async");
|
|
|
563
565
|
var import_context3 = require("@dxos/context");
|
|
564
566
|
var import_keys3 = require("@dxos/keys");
|
|
565
567
|
var import_log3 = require("@dxos/log");
|
|
566
|
-
|
|
568
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
567
569
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
568
570
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
569
571
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -572,7 +574,8 @@ var __decorate2 = function(decorators, target, key, desc) {
|
|
|
572
574
|
if (d = decorators[i])
|
|
573
575
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
574
576
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
575
|
-
}
|
|
577
|
+
}
|
|
578
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/peer.ts";
|
|
576
579
|
var CONNECTION_COUNTS_STABLE_AFTER = 5e3;
|
|
577
580
|
var Peer = class {
|
|
578
581
|
constructor(id, topic, localPeerId, _signalMessaging, _protocolProvider, _transportFactory, _callbacks) {
|
|
@@ -601,10 +604,10 @@ var Peer = class {
|
|
|
601
604
|
topic: this.topic,
|
|
602
605
|
peerId: this.localPeerId
|
|
603
606
|
}, {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
607
|
+
F: __dxlog_file3,
|
|
608
|
+
L: 105,
|
|
609
|
+
S: this,
|
|
610
|
+
C: (f, a) => f(...a)
|
|
608
611
|
});
|
|
609
612
|
if (this.connection) {
|
|
610
613
|
await this.closeConnection();
|
|
@@ -628,10 +631,10 @@ var Peer = class {
|
|
|
628
631
|
remoteId: this.id,
|
|
629
632
|
err
|
|
630
633
|
}, {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
634
|
+
F: __dxlog_file3,
|
|
635
|
+
L: 129,
|
|
636
|
+
S: this,
|
|
637
|
+
C: (f, a) => f(...a)
|
|
635
638
|
});
|
|
636
639
|
await this.closeConnection();
|
|
637
640
|
}
|
|
@@ -657,10 +660,10 @@ var Peer = class {
|
|
|
657
660
|
peerId: this.id,
|
|
658
661
|
sessionId
|
|
659
662
|
}, {
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
663
|
+
F: __dxlog_file3,
|
|
664
|
+
L: 147,
|
|
665
|
+
S: this,
|
|
666
|
+
C: (f, a) => f(...a)
|
|
664
667
|
});
|
|
665
668
|
const connection = this._createConnection(true, sessionId);
|
|
666
669
|
this.initiating = true;
|
|
@@ -680,17 +683,17 @@ var Peer = class {
|
|
|
680
683
|
ownId: this.localPeerId,
|
|
681
684
|
remoteId: this.id
|
|
682
685
|
}, {
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
686
|
+
F: __dxlog_file3,
|
|
687
|
+
L: 159,
|
|
688
|
+
S: this,
|
|
689
|
+
C: (f, a) => f(...a)
|
|
687
690
|
});
|
|
688
691
|
if (connection.state !== ConnectionState.INITIAL) {
|
|
689
|
-
(0, import_log3.log)("ignoring response",
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
692
|
+
(0, import_log3.log)("ignoring response", void 0, {
|
|
693
|
+
F: __dxlog_file3,
|
|
694
|
+
L: 161,
|
|
695
|
+
S: this,
|
|
696
|
+
C: (f, a) => f(...a)
|
|
694
697
|
});
|
|
695
698
|
return;
|
|
696
699
|
}
|
|
@@ -707,10 +710,10 @@ var Peer = class {
|
|
|
707
710
|
peerId: this.localPeerId,
|
|
708
711
|
remoteId: this.id
|
|
709
712
|
}, {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
713
|
+
F: __dxlog_file3,
|
|
714
|
+
L: 172,
|
|
715
|
+
S: this,
|
|
716
|
+
C: (f, a) => f(...a)
|
|
714
717
|
});
|
|
715
718
|
await this.closeConnection();
|
|
716
719
|
throw err;
|
|
@@ -731,10 +734,10 @@ var Peer = class {
|
|
|
731
734
|
initiator,
|
|
732
735
|
sessionId
|
|
733
736
|
}, {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
737
|
+
F: __dxlog_file3,
|
|
738
|
+
L: 186,
|
|
739
|
+
S: this,
|
|
740
|
+
C: (f, a) => f(...a)
|
|
738
741
|
});
|
|
739
742
|
(0, import_tiny_invariant3.default)(!this.connection, "Already connected.");
|
|
740
743
|
const connection = new Connection(
|
|
@@ -771,10 +774,10 @@ var Peer = class {
|
|
|
771
774
|
remoteId: this.id,
|
|
772
775
|
initiator
|
|
773
776
|
}, {
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
777
|
+
F: __dxlog_file3,
|
|
778
|
+
L: 221,
|
|
779
|
+
S: this,
|
|
780
|
+
C: (f, a) => f(...a)
|
|
778
781
|
});
|
|
779
782
|
(0, import_tiny_invariant3.default)(this.connection === connection, "Connection mismatch (race condition).");
|
|
780
783
|
if (this._lastConnectionTime && this._lastConnectionTime + CONNECTION_COUNTS_STABLE_AFTER < Date.now()) {
|
|
@@ -801,10 +804,10 @@ var Peer = class {
|
|
|
801
804
|
initiator,
|
|
802
805
|
err
|
|
803
806
|
}, {
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
807
|
+
F: __dxlog_file3,
|
|
808
|
+
L: 249,
|
|
809
|
+
S: this,
|
|
810
|
+
C: (f, a) => f(...a)
|
|
808
811
|
});
|
|
809
812
|
void this.closeConnection();
|
|
810
813
|
});
|
|
@@ -820,20 +823,20 @@ var Peer = class {
|
|
|
820
823
|
peerId: this.id,
|
|
821
824
|
sessionId: connection.sessionId
|
|
822
825
|
}, {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
826
|
+
F: __dxlog_file3,
|
|
827
|
+
L: 265,
|
|
828
|
+
S: this,
|
|
829
|
+
C: (f, a) => f(...a)
|
|
827
830
|
});
|
|
828
831
|
await connection.close();
|
|
829
832
|
(0, import_log3.log)("closed", {
|
|
830
833
|
peerId: this.id,
|
|
831
834
|
sessionId: connection.sessionId
|
|
832
835
|
}, {
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
836
|
+
F: __dxlog_file3,
|
|
837
|
+
L: 271,
|
|
838
|
+
S: this,
|
|
839
|
+
C: (f, a) => f(...a)
|
|
837
840
|
});
|
|
838
841
|
}
|
|
839
842
|
async onSignal(message) {
|
|
@@ -841,10 +844,10 @@ var Peer = class {
|
|
|
841
844
|
(0, import_log3.log)("dropping signal message for non-existent connection", {
|
|
842
845
|
message
|
|
843
846
|
}, {
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
847
|
+
F: __dxlog_file3,
|
|
848
|
+
L: 276,
|
|
849
|
+
S: this,
|
|
850
|
+
C: (f, a) => f(...a)
|
|
848
851
|
});
|
|
849
852
|
return;
|
|
850
853
|
}
|
|
@@ -857,15 +860,15 @@ var Peer = class {
|
|
|
857
860
|
peerId: this.id,
|
|
858
861
|
topic: this.topic
|
|
859
862
|
}, {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
863
|
+
F: __dxlog_file3,
|
|
864
|
+
L: 285,
|
|
865
|
+
S: this,
|
|
866
|
+
C: (f, a) => f(...a)
|
|
864
867
|
});
|
|
865
868
|
await ((_a = this == null ? void 0 : this.connection) == null ? void 0 : _a.close());
|
|
866
869
|
}
|
|
867
870
|
};
|
|
868
|
-
|
|
871
|
+
_ts_decorate2([
|
|
869
872
|
import_async2.synchronized
|
|
870
873
|
], Peer.prototype, "destroy", null);
|
|
871
874
|
var increaseInterval = (interval) => {
|
|
@@ -882,7 +885,7 @@ var increaseInterval = (interval) => {
|
|
|
882
885
|
};
|
|
883
886
|
|
|
884
887
|
// packages/core/mesh/network-manager/src/swarm/swarm.ts
|
|
885
|
-
|
|
888
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
886
889
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
887
890
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
888
891
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -891,7 +894,8 @@ var __decorate3 = function(decorators, target, key, desc) {
|
|
|
891
894
|
if (d = decorators[i])
|
|
892
895
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
893
896
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
894
|
-
}
|
|
897
|
+
}
|
|
898
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/swarm.ts";
|
|
895
899
|
var INITIATION_DELAY = 100;
|
|
896
900
|
var getClassName = (obj) => Object.getPrototypeOf(obj).constructor.name;
|
|
897
901
|
var Swarm = class {
|
|
@@ -908,11 +912,11 @@ var Swarm = class {
|
|
|
908
912
|
this._peers = new import_util2.ComplexMap(import_keys4.PublicKey.hash);
|
|
909
913
|
this._ctx = new import_context4.Context();
|
|
910
914
|
this._listeningHandle = void 0;
|
|
915
|
+
this._instanceId = import_keys4.PublicKey.random().toHex();
|
|
911
916
|
this.connectionAdded = new import_async3.Event();
|
|
912
917
|
this.disconnected = new import_async3.Event();
|
|
913
918
|
this.connected = new import_async3.Event();
|
|
914
919
|
this.errors = new import_debug2.ErrorStream();
|
|
915
|
-
this._instanceId = import_keys4.PublicKey.random().toHex();
|
|
916
920
|
import_log4.log.trace("dxos.mesh.swarm.constructor", import_protocols3.trace.begin({
|
|
917
921
|
id: this._instanceId,
|
|
918
922
|
data: {
|
|
@@ -920,18 +924,18 @@ var Swarm = class {
|
|
|
920
924
|
peerId: this._ownPeerId.toHex()
|
|
921
925
|
}
|
|
922
926
|
}), {
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
+
F: __dxlog_file4,
|
|
928
|
+
L: 86,
|
|
929
|
+
S: this,
|
|
930
|
+
C: (f, a) => f(...a)
|
|
927
931
|
});
|
|
928
932
|
(0, import_log4.log)("creating swarm", {
|
|
929
933
|
peerId: _ownPeerId
|
|
930
934
|
}, {
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
+
F: __dxlog_file4,
|
|
936
|
+
L: 90,
|
|
937
|
+
S: this,
|
|
938
|
+
C: (f, a) => f(...a)
|
|
935
939
|
});
|
|
936
940
|
_topology.init(this._getSwarmController());
|
|
937
941
|
this._swarmMessenger = new SwarmMessenger({
|
|
@@ -943,10 +947,10 @@ var Swarm = class {
|
|
|
943
947
|
import_log4.log.trace("dxos.mesh.swarm.constructor", import_protocols3.trace.end({
|
|
944
948
|
id: this._instanceId
|
|
945
949
|
}), {
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
+
F: __dxlog_file4,
|
|
951
|
+
L: 99,
|
|
952
|
+
S: this,
|
|
953
|
+
C: (f, a) => f(...a)
|
|
950
954
|
});
|
|
951
955
|
}
|
|
952
956
|
get connections() {
|
|
@@ -973,32 +977,32 @@ var Swarm = class {
|
|
|
973
977
|
await this._swarmMessenger.receiveMessage(message).catch((err) => import_log4.log.warn("Error while receiving message", {
|
|
974
978
|
err
|
|
975
979
|
}, {
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
+
F: __dxlog_file4,
|
|
981
|
+
L: 133,
|
|
982
|
+
S: this,
|
|
983
|
+
C: (f, a) => f(...a)
|
|
980
984
|
}));
|
|
981
985
|
}
|
|
982
986
|
});
|
|
983
987
|
}
|
|
984
988
|
async destroy() {
|
|
985
989
|
var _a;
|
|
986
|
-
(0, import_log4.log)("destroying...",
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
990
|
+
(0, import_log4.log)("destroying...", void 0, {
|
|
991
|
+
F: __dxlog_file4,
|
|
992
|
+
L: 139,
|
|
993
|
+
S: this,
|
|
994
|
+
C: (f, a) => f(...a)
|
|
991
995
|
});
|
|
992
996
|
await ((_a = this._listeningHandle) == null ? void 0 : _a.unsubscribe());
|
|
993
997
|
this._listeningHandle = void 0;
|
|
994
998
|
await this._ctx.dispose();
|
|
995
999
|
await this._topology.destroy();
|
|
996
1000
|
await Promise.all(Array.from(this._peers.keys()).map((key) => this._destroyPeer(key)));
|
|
997
|
-
(0, import_log4.log)("destroyed",
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1001
|
+
(0, import_log4.log)("destroyed", void 0, {
|
|
1002
|
+
F: __dxlog_file4,
|
|
1003
|
+
L: 146,
|
|
1004
|
+
S: this,
|
|
1005
|
+
C: (f, a) => f(...a)
|
|
1002
1006
|
});
|
|
1003
1007
|
}
|
|
1004
1008
|
async setTopology(topology) {
|
|
@@ -1010,10 +1014,10 @@ var Swarm = class {
|
|
|
1010
1014
|
previous: getClassName(this._topology),
|
|
1011
1015
|
topology: getClassName(topology)
|
|
1012
1016
|
}, {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
+
F: __dxlog_file4,
|
|
1018
|
+
L: 154,
|
|
1019
|
+
S: this,
|
|
1020
|
+
C: (f, a) => f(...a)
|
|
1017
1021
|
});
|
|
1018
1022
|
await this._topology.destroy();
|
|
1019
1023
|
this._topology = topology;
|
|
@@ -1025,17 +1029,17 @@ var Swarm = class {
|
|
|
1025
1029
|
(0, import_log4.log)("swarm event", {
|
|
1026
1030
|
swarmEvent
|
|
1027
1031
|
}, {
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
+
F: __dxlog_file4,
|
|
1033
|
+
L: 167,
|
|
1034
|
+
S: this,
|
|
1035
|
+
C: (f, a) => f(...a)
|
|
1032
1036
|
});
|
|
1033
1037
|
if (this._ctx.disposed) {
|
|
1034
|
-
(0, import_log4.log)("swarm event ignored for disposed swarm",
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1038
|
+
(0, import_log4.log)("swarm event ignored for disposed swarm", void 0, {
|
|
1039
|
+
F: __dxlog_file4,
|
|
1040
|
+
L: 170,
|
|
1041
|
+
S: this,
|
|
1042
|
+
C: (f, a) => f(...a)
|
|
1039
1043
|
});
|
|
1040
1044
|
return;
|
|
1041
1045
|
}
|
|
@@ -1044,25 +1048,25 @@ var Swarm = class {
|
|
|
1044
1048
|
(0, import_log4.log)("new peer", {
|
|
1045
1049
|
peerId
|
|
1046
1050
|
}, {
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
+
F: __dxlog_file4,
|
|
1052
|
+
L: 176,
|
|
1053
|
+
S: this,
|
|
1054
|
+
C: (f, a) => f(...a)
|
|
1051
1055
|
});
|
|
1052
1056
|
if (!peerId.equals(this._ownPeerId)) {
|
|
1053
1057
|
const peer = this._getOrCreatePeer(peerId);
|
|
1054
1058
|
peer.advertizing = true;
|
|
1055
1059
|
}
|
|
1056
1060
|
} else if (swarmEvent.peerLeft) {
|
|
1057
|
-
const
|
|
1058
|
-
if (
|
|
1059
|
-
|
|
1060
|
-
if (((_a =
|
|
1061
|
-
void this._destroyPeer(
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1061
|
+
const peer = this._peers.get(import_keys4.PublicKey.from(swarmEvent.peerLeft.peer));
|
|
1062
|
+
if (peer) {
|
|
1063
|
+
peer.advertizing = false;
|
|
1064
|
+
if (((_a = peer.connection) == null ? void 0 : _a.state) !== ConnectionState.CONNECTED) {
|
|
1065
|
+
void this._destroyPeer(peer.id).catch((err) => import_log4.log.catch(err, void 0, {
|
|
1066
|
+
F: __dxlog_file4,
|
|
1067
|
+
L: 187,
|
|
1068
|
+
S: this,
|
|
1069
|
+
C: (f, a) => f(...a)
|
|
1066
1070
|
}));
|
|
1067
1071
|
}
|
|
1068
1072
|
}
|
|
@@ -1074,17 +1078,17 @@ var Swarm = class {
|
|
|
1074
1078
|
(0, import_log4.log)("offer", {
|
|
1075
1079
|
message
|
|
1076
1080
|
}, {
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
+
F: __dxlog_file4,
|
|
1082
|
+
L: 197,
|
|
1083
|
+
S: this,
|
|
1084
|
+
C: (f, a) => f(...a)
|
|
1081
1085
|
});
|
|
1082
1086
|
if (this._ctx.disposed) {
|
|
1083
|
-
(0, import_log4.log)("ignored for disposed swarm",
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1087
|
+
(0, import_log4.log)("ignored for disposed swarm", void 0, {
|
|
1088
|
+
F: __dxlog_file4,
|
|
1089
|
+
L: 199,
|
|
1090
|
+
S: this,
|
|
1091
|
+
C: (f, a) => f(...a)
|
|
1088
1092
|
});
|
|
1089
1093
|
return {
|
|
1090
1094
|
accept: false
|
|
@@ -1095,10 +1099,10 @@ var Swarm = class {
|
|
|
1095
1099
|
(0, import_log4.log)("rejecting offer with incorrect peerId", {
|
|
1096
1100
|
message
|
|
1097
1101
|
}, {
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
+
F: __dxlog_file4,
|
|
1103
|
+
L: 206,
|
|
1104
|
+
S: this,
|
|
1105
|
+
C: (f, a) => f(...a)
|
|
1102
1106
|
});
|
|
1103
1107
|
return {
|
|
1104
1108
|
accept: false
|
|
@@ -1108,10 +1112,10 @@ var Swarm = class {
|
|
|
1108
1112
|
(0, import_log4.log)("rejecting offer with incorrect topic", {
|
|
1109
1113
|
message
|
|
1110
1114
|
}, {
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
+
F: __dxlog_file4,
|
|
1116
|
+
L: 210,
|
|
1117
|
+
S: this,
|
|
1118
|
+
C: (f, a) => f(...a)
|
|
1115
1119
|
});
|
|
1116
1120
|
return {
|
|
1117
1121
|
accept: false
|
|
@@ -1127,17 +1131,17 @@ var Swarm = class {
|
|
|
1127
1131
|
(0, import_log4.log)("signal", {
|
|
1128
1132
|
message
|
|
1129
1133
|
}, {
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
+
F: __dxlog_file4,
|
|
1135
|
+
L: 222,
|
|
1136
|
+
S: this,
|
|
1137
|
+
C: (f, a) => f(...a)
|
|
1134
1138
|
});
|
|
1135
1139
|
if (this._ctx.disposed) {
|
|
1136
|
-
import_log4.log.info("ignored for offline swarm",
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1140
|
+
import_log4.log.info("ignored for offline swarm", void 0, {
|
|
1141
|
+
F: __dxlog_file4,
|
|
1142
|
+
L: 224,
|
|
1143
|
+
S: this,
|
|
1144
|
+
C: (f, a) => f(...a)
|
|
1141
1145
|
});
|
|
1142
1146
|
return;
|
|
1143
1147
|
}
|
|
@@ -1215,10 +1219,10 @@ var Swarm = class {
|
|
|
1215
1219
|
await this._initiateConnection(peer);
|
|
1216
1220
|
} catch (err) {
|
|
1217
1221
|
(0, import_log4.log)("initiation error", err, {
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
+
F: __dxlog_file4,
|
|
1223
|
+
L: 327,
|
|
1224
|
+
S: this,
|
|
1225
|
+
C: (f, a) => f(...a)
|
|
1222
1226
|
});
|
|
1223
1227
|
}
|
|
1224
1228
|
});
|
|
@@ -1243,10 +1247,10 @@ var Swarm = class {
|
|
|
1243
1247
|
(0, import_log4.log)("initiation delay", {
|
|
1244
1248
|
remoteId
|
|
1245
1249
|
}, {
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
+
F: __dxlog_file4,
|
|
1251
|
+
L: 354,
|
|
1252
|
+
S: this,
|
|
1253
|
+
C: (f, a) => f(...a)
|
|
1250
1254
|
});
|
|
1251
1255
|
await (0, import_async3.sleep)(INITIATION_DELAY);
|
|
1252
1256
|
}
|
|
@@ -1260,20 +1264,20 @@ var Swarm = class {
|
|
|
1260
1264
|
(0, import_log4.log)("initiating connection...", {
|
|
1261
1265
|
remoteId
|
|
1262
1266
|
}, {
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
+
F: __dxlog_file4,
|
|
1268
|
+
L: 368,
|
|
1269
|
+
S: this,
|
|
1270
|
+
C: (f, a) => f(...a)
|
|
1267
1271
|
});
|
|
1268
1272
|
await peer.initiateConnection();
|
|
1269
1273
|
this._topology.update();
|
|
1270
1274
|
(0, import_log4.log)("initiated", {
|
|
1271
1275
|
remoteId
|
|
1272
1276
|
}, {
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
+
F: __dxlog_file4,
|
|
1278
|
+
L: 371,
|
|
1279
|
+
S: this,
|
|
1280
|
+
C: (f, a) => f(...a)
|
|
1277
1281
|
});
|
|
1278
1282
|
}
|
|
1279
1283
|
async _closeConnection(peerId) {
|
|
@@ -1284,28 +1288,28 @@ var Swarm = class {
|
|
|
1284
1288
|
await peer.closeConnection();
|
|
1285
1289
|
}
|
|
1286
1290
|
};
|
|
1287
|
-
|
|
1291
|
+
_ts_decorate3([
|
|
1288
1292
|
import_log4.logInfo
|
|
1289
1293
|
], Swarm.prototype, "_instanceId", void 0);
|
|
1290
|
-
|
|
1294
|
+
_ts_decorate3([
|
|
1291
1295
|
import_log4.logInfo
|
|
1292
1296
|
], Swarm.prototype, "ownPeerId", null);
|
|
1293
|
-
|
|
1297
|
+
_ts_decorate3([
|
|
1294
1298
|
import_log4.logInfo
|
|
1295
1299
|
], Swarm.prototype, "topic", null);
|
|
1296
|
-
|
|
1300
|
+
_ts_decorate3([
|
|
1297
1301
|
import_async3.synchronized
|
|
1298
1302
|
], Swarm.prototype, "onSwarmEvent", null);
|
|
1299
|
-
|
|
1303
|
+
_ts_decorate3([
|
|
1300
1304
|
import_async3.synchronized
|
|
1301
1305
|
], Swarm.prototype, "onOffer", null);
|
|
1302
|
-
|
|
1306
|
+
_ts_decorate3([
|
|
1303
1307
|
import_async3.synchronized
|
|
1304
1308
|
], Swarm.prototype, "onSignal", null);
|
|
1305
|
-
|
|
1309
|
+
_ts_decorate3([
|
|
1306
1310
|
import_async3.synchronized
|
|
1307
1311
|
], Swarm.prototype, "goOffline", null);
|
|
1308
|
-
|
|
1312
|
+
_ts_decorate3([
|
|
1309
1313
|
import_async3.synchronized
|
|
1310
1314
|
], Swarm.prototype, "goOnline", null);
|
|
1311
1315
|
|
|
@@ -1314,6 +1318,7 @@ var import_async4 = require("@dxos/async");
|
|
|
1314
1318
|
var import_keys5 = require("@dxos/keys");
|
|
1315
1319
|
var import_log5 = require("@dxos/log");
|
|
1316
1320
|
var import_util3 = require("@dxos/util");
|
|
1321
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/swarm-mapper.ts";
|
|
1317
1322
|
var SwarmMapper = class {
|
|
1318
1323
|
get peers() {
|
|
1319
1324
|
return Array.from(this._peers.values());
|
|
@@ -1340,11 +1345,11 @@ var SwarmMapper = class {
|
|
|
1340
1345
|
this._update();
|
|
1341
1346
|
}
|
|
1342
1347
|
_update() {
|
|
1343
|
-
(0, import_log5.log)("updating swarm",
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
+
(0, import_log5.log)("updating swarm", void 0, {
|
|
1349
|
+
F: __dxlog_file5,
|
|
1350
|
+
L: 75,
|
|
1351
|
+
S: this,
|
|
1352
|
+
C: (f, a) => f(...a)
|
|
1348
1353
|
});
|
|
1349
1354
|
this._peers.clear();
|
|
1350
1355
|
this._peers.set(this._swarm.ownPeerId, {
|
|
@@ -1365,10 +1370,10 @@ var SwarmMapper = class {
|
|
|
1365
1370
|
directConnections: this._swarm.connections.length,
|
|
1366
1371
|
totalPeersInSwarm: this._peers.size
|
|
1367
1372
|
}, {
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1373
|
+
F: __dxlog_file5,
|
|
1374
|
+
L: 116,
|
|
1375
|
+
S: this,
|
|
1376
|
+
C: (f, a) => f(...a)
|
|
1372
1377
|
});
|
|
1373
1378
|
this.mapUpdated.emit(Array.from(this._peers.values()));
|
|
1374
1379
|
}
|
|
@@ -1454,8 +1459,9 @@ var import_messaging = require("@dxos/messaging");
|
|
|
1454
1459
|
var import_protocols4 = require("@dxos/protocols");
|
|
1455
1460
|
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
1456
1461
|
var import_util5 = require("@dxos/util");
|
|
1462
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/network-manager.ts";
|
|
1457
1463
|
var NetworkManager = class {
|
|
1458
|
-
constructor({ transportFactory, signalManager, log:
|
|
1464
|
+
constructor({ transportFactory, signalManager, log: log1 }) {
|
|
1459
1465
|
this._swarms = new import_util5.ComplexMap(import_keys7.PublicKey.hash);
|
|
1460
1466
|
this._mappers = new import_util5.ComplexMap(import_keys7.PublicKey.hash);
|
|
1461
1467
|
this._connectionState = import_services.ConnectionState.ONLINE;
|
|
@@ -1475,7 +1481,7 @@ var NetworkManager = class {
|
|
|
1475
1481
|
join: (opts) => this._signalManager.join(opts),
|
|
1476
1482
|
leave: (opts) => this._signalManager.leave(opts)
|
|
1477
1483
|
};
|
|
1478
|
-
if (
|
|
1484
|
+
if (log1) {
|
|
1479
1485
|
this._connectionLog = new ConnectionLog();
|
|
1480
1486
|
}
|
|
1481
1487
|
}
|
|
@@ -1500,30 +1506,30 @@ var NetworkManager = class {
|
|
|
1500
1506
|
import_log6.log.trace("dxos.mesh.network-manager.open", import_protocols4.trace.begin({
|
|
1501
1507
|
id: this._instanceId
|
|
1502
1508
|
}), {
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1509
|
+
F: __dxlog_file6,
|
|
1510
|
+
L: 127,
|
|
1511
|
+
S: this,
|
|
1512
|
+
C: (f, a) => f(...a)
|
|
1507
1513
|
});
|
|
1508
1514
|
await this._messenger.open();
|
|
1509
1515
|
await this._signalManager.open();
|
|
1510
1516
|
import_log6.log.trace("dxos.mesh.network-manager.open", import_protocols4.trace.end({
|
|
1511
1517
|
id: this._instanceId
|
|
1512
1518
|
}), {
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1519
|
+
F: __dxlog_file6,
|
|
1520
|
+
L: 130,
|
|
1521
|
+
S: this,
|
|
1522
|
+
C: (f, a) => f(...a)
|
|
1517
1523
|
});
|
|
1518
1524
|
}
|
|
1519
1525
|
async close() {
|
|
1520
1526
|
for (const topic of this._swarms.keys()) {
|
|
1521
1527
|
await this.leaveSwarm(topic).catch((err) => {
|
|
1522
|
-
(0, import_log6.log)(err,
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1528
|
+
(0, import_log6.log)(err, void 0, {
|
|
1529
|
+
F: __dxlog_file6,
|
|
1530
|
+
L: 136,
|
|
1531
|
+
S: this,
|
|
1532
|
+
C: (f, a) => f(...a)
|
|
1527
1533
|
});
|
|
1528
1534
|
});
|
|
1529
1535
|
}
|
|
@@ -1547,20 +1553,20 @@ var NetworkManager = class {
|
|
|
1547
1553
|
peerId,
|
|
1548
1554
|
topology: topology.toString()
|
|
1549
1555
|
}, {
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1556
|
+
F: __dxlog_file6,
|
|
1557
|
+
L: 162,
|
|
1558
|
+
S: this,
|
|
1559
|
+
C: (f, a) => f(...a)
|
|
1554
1560
|
});
|
|
1555
1561
|
const swarm = new Swarm(topic, peerId, topology, protocol, this._messenger, this._transportFactory, label);
|
|
1556
1562
|
swarm.errors.handle((error) => {
|
|
1557
1563
|
(0, import_log6.log)("swarm error", {
|
|
1558
1564
|
error
|
|
1559
1565
|
}, {
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1566
|
+
F: __dxlog_file6,
|
|
1567
|
+
L: 165,
|
|
1568
|
+
S: this,
|
|
1569
|
+
C: (f, a) => f(...a)
|
|
1564
1570
|
});
|
|
1565
1571
|
});
|
|
1566
1572
|
this._swarms.set(topic, swarm);
|
|
@@ -1569,11 +1575,11 @@ var NetworkManager = class {
|
|
|
1569
1575
|
this._signalConnection.join({
|
|
1570
1576
|
topic,
|
|
1571
1577
|
peerId
|
|
1572
|
-
}).catch((error) => import_log6.log.catch(error,
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1578
|
+
}).catch((error) => import_log6.log.catch(error, void 0, {
|
|
1579
|
+
F: __dxlog_file6,
|
|
1580
|
+
L: 174,
|
|
1581
|
+
S: this,
|
|
1582
|
+
C: (f, a) => f(...a)
|
|
1577
1583
|
}));
|
|
1578
1584
|
this.topicsUpdated.emit();
|
|
1579
1585
|
(_a = this._connectionLog) == null ? void 0 : _a.joinedSwarm(swarm);
|
|
@@ -1581,10 +1587,10 @@ var NetworkManager = class {
|
|
|
1581
1587
|
topic: import_keys7.PublicKey.from(topic),
|
|
1582
1588
|
count: this._swarms.size
|
|
1583
1589
|
}, {
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1590
|
+
F: __dxlog_file6,
|
|
1591
|
+
L: 178,
|
|
1592
|
+
S: this,
|
|
1593
|
+
C: (f, a) => f(...a)
|
|
1588
1594
|
});
|
|
1589
1595
|
return {
|
|
1590
1596
|
close: () => this.leaveSwarm(topic)
|
|
@@ -1601,10 +1607,10 @@ var NetworkManager = class {
|
|
|
1601
1607
|
(0, import_log6.log)("leaving", {
|
|
1602
1608
|
topic: import_keys7.PublicKey.from(topic)
|
|
1603
1609
|
}, {
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1610
|
+
F: __dxlog_file6,
|
|
1611
|
+
L: 194,
|
|
1612
|
+
S: this,
|
|
1613
|
+
C: (f, a) => f(...a)
|
|
1608
1614
|
});
|
|
1609
1615
|
const swarm = this._swarms.get(topic);
|
|
1610
1616
|
await this._signalConnection.leave({
|
|
@@ -1622,10 +1628,10 @@ var NetworkManager = class {
|
|
|
1622
1628
|
topic: import_keys7.PublicKey.from(topic),
|
|
1623
1629
|
count: this._swarms.size
|
|
1624
1630
|
}, {
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1631
|
+
F: __dxlog_file6,
|
|
1632
|
+
L: 208,
|
|
1633
|
+
S: this,
|
|
1634
|
+
C: (f, a) => f(...a)
|
|
1629
1635
|
});
|
|
1630
1636
|
}
|
|
1631
1637
|
async setConnectionState(state) {
|
|
@@ -1684,6 +1690,7 @@ var FullyConnectedTopology = class {
|
|
|
1684
1690
|
var import_tiny_invariant7 = __toESM(require("tiny-invariant"));
|
|
1685
1691
|
var import_xor_distance = __toESM(require("xor-distance"));
|
|
1686
1692
|
var import_log7 = require("@dxos/log");
|
|
1693
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/mmst-topology.ts";
|
|
1687
1694
|
var MMSTTopology = class {
|
|
1688
1695
|
constructor({ originateConnections = 2, maxPeers = 4, sampleSize = 10 } = {}) {
|
|
1689
1696
|
this._sampleCollected = false;
|
|
@@ -1699,11 +1706,11 @@ var MMSTTopology = class {
|
|
|
1699
1706
|
(0, import_tiny_invariant7.default)(this._controller, "Not initialized");
|
|
1700
1707
|
const { connected, candidates } = this._controller.getState();
|
|
1701
1708
|
if (this._sampleCollected || connected.length > this._maxPeers || candidates.length > 0) {
|
|
1702
|
-
(0, import_log7.log)("Running the algorithm.",
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1709
|
+
(0, import_log7.log)("Running the algorithm.", void 0, {
|
|
1710
|
+
F: __dxlog_file7,
|
|
1711
|
+
L: 55,
|
|
1712
|
+
S: this,
|
|
1713
|
+
C: (f, a) => f(...a)
|
|
1707
1714
|
});
|
|
1708
1715
|
this._sampleCollected = true;
|
|
1709
1716
|
this._runAlgorithm();
|
|
@@ -1713,11 +1720,11 @@ var MMSTTopology = class {
|
|
|
1713
1720
|
(0, import_tiny_invariant7.default)(this._controller, "Not initialized");
|
|
1714
1721
|
const { connected } = this._controller.getState();
|
|
1715
1722
|
const accept = connected.length < this._maxPeers;
|
|
1716
|
-
(0, import_log7.log)(`Offer ${peer} accept=${accept}`,
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1723
|
+
(0, import_log7.log)(`Offer ${peer} accept=${accept}`, void 0, {
|
|
1724
|
+
F: __dxlog_file7,
|
|
1725
|
+
L: 65,
|
|
1726
|
+
S: this,
|
|
1727
|
+
C: (f, a) => f(...a)
|
|
1721
1728
|
});
|
|
1722
1729
|
return accept;
|
|
1723
1730
|
}
|
|
@@ -1729,25 +1736,25 @@ var MMSTTopology = class {
|
|
|
1729
1736
|
if (connected.length > this._maxPeers) {
|
|
1730
1737
|
const sorted = sortByXorDistance(connected, ownPeerId).reverse().slice(0, this._maxPeers - connected.length);
|
|
1731
1738
|
for (const peer of sorted) {
|
|
1732
|
-
(0, import_log7.log)(`Disconnect ${peer}.`,
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1739
|
+
(0, import_log7.log)(`Disconnect ${peer}.`, void 0, {
|
|
1740
|
+
F: __dxlog_file7,
|
|
1741
|
+
L: 83,
|
|
1742
|
+
S: this,
|
|
1743
|
+
C: (f, a) => f(...a)
|
|
1737
1744
|
});
|
|
1738
1745
|
this._controller.disconnect(peer);
|
|
1739
1746
|
}
|
|
1740
1747
|
} else if (connected.length < this._originateConnections) {
|
|
1741
1748
|
const sample = candidates.sort(() => Math.random() - 0.5).slice(0, this._sampleSize);
|
|
1742
|
-
const
|
|
1743
|
-
for (const
|
|
1744
|
-
(0, import_log7.log)(`Connect ${
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
+
const sorted = sortByXorDistance(sample, ownPeerId).slice(0, this._originateConnections - connected.length);
|
|
1750
|
+
for (const peer of sorted) {
|
|
1751
|
+
(0, import_log7.log)(`Connect ${peer}.`, void 0, {
|
|
1752
|
+
F: __dxlog_file7,
|
|
1753
|
+
L: 91,
|
|
1754
|
+
S: this,
|
|
1755
|
+
C: (f, a) => f(...a)
|
|
1749
1756
|
});
|
|
1750
|
-
this._controller.connect(
|
|
1757
|
+
this._controller.connect(peer);
|
|
1751
1758
|
}
|
|
1752
1759
|
}
|
|
1753
1760
|
}
|
|
@@ -1760,6 +1767,7 @@ var sortByXorDistance = (keys, reference) => keys.sort((a, b) => import_xor_dist
|
|
|
1760
1767
|
// packages/core/mesh/network-manager/src/topology/star-topology.ts
|
|
1761
1768
|
var import_tiny_invariant8 = __toESM(require("tiny-invariant"));
|
|
1762
1769
|
var import_log8 = require("@dxos/log");
|
|
1770
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/star-topology.ts";
|
|
1763
1771
|
var StarTopology = class {
|
|
1764
1772
|
// prettier-ignore
|
|
1765
1773
|
constructor(_centralPeer) {
|
|
@@ -1776,37 +1784,37 @@ var StarTopology = class {
|
|
|
1776
1784
|
(0, import_tiny_invariant8.default)(this._controller, "Not initialized.");
|
|
1777
1785
|
const { candidates, connected, ownPeerId } = this._controller.getState();
|
|
1778
1786
|
if (!ownPeerId.equals(this._centralPeer)) {
|
|
1779
|
-
(0, import_log8.log)("leaf peer dropping all connections apart from central peer.",
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1787
|
+
(0, import_log8.log)("leaf peer dropping all connections apart from central peer.", void 0, {
|
|
1788
|
+
F: __dxlog_file8,
|
|
1789
|
+
L: 33,
|
|
1790
|
+
S: this,
|
|
1791
|
+
C: (f, a) => f(...a)
|
|
1784
1792
|
});
|
|
1785
1793
|
for (const peer of connected) {
|
|
1786
1794
|
if (!peer.equals(this._centralPeer)) {
|
|
1787
1795
|
(0, import_log8.log)("dropping connection", {
|
|
1788
1796
|
peer
|
|
1789
1797
|
}, {
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1798
|
+
F: __dxlog_file8,
|
|
1799
|
+
L: 38,
|
|
1800
|
+
S: this,
|
|
1801
|
+
C: (f, a) => f(...a)
|
|
1794
1802
|
});
|
|
1795
1803
|
this._controller.disconnect(peer);
|
|
1796
1804
|
}
|
|
1797
1805
|
}
|
|
1798
1806
|
}
|
|
1799
|
-
for (const
|
|
1800
|
-
if (
|
|
1807
|
+
for (const peer of candidates) {
|
|
1808
|
+
if (peer.equals(this._centralPeer) || ownPeerId.equals(this._centralPeer)) {
|
|
1801
1809
|
(0, import_log8.log)("connecting to peer", {
|
|
1802
|
-
peer
|
|
1810
|
+
peer
|
|
1803
1811
|
}, {
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1812
|
+
F: __dxlog_file8,
|
|
1813
|
+
L: 47,
|
|
1814
|
+
S: this,
|
|
1815
|
+
C: (f, a) => f(...a)
|
|
1808
1816
|
});
|
|
1809
|
-
this._controller.connect(
|
|
1817
|
+
this._controller.connect(peer);
|
|
1810
1818
|
}
|
|
1811
1819
|
}
|
|
1812
1820
|
}
|
|
@@ -1818,10 +1826,10 @@ var StarTopology = class {
|
|
|
1818
1826
|
isCentral: peer.equals(this._centralPeer),
|
|
1819
1827
|
isSelfCentral: ownPeerId.equals(this._centralPeer)
|
|
1820
1828
|
}, {
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1829
|
+
F: __dxlog_file8,
|
|
1830
|
+
L: 56,
|
|
1831
|
+
S: this,
|
|
1832
|
+
C: (f, a) => f(...a)
|
|
1825
1833
|
});
|
|
1826
1834
|
return ownPeerId.equals(this._centralPeer) || peer.equals(this._centralPeer);
|
|
1827
1835
|
}
|
|
@@ -1837,7 +1845,7 @@ var import_debug4 = require("@dxos/debug");
|
|
|
1837
1845
|
var import_keys8 = require("@dxos/keys");
|
|
1838
1846
|
var import_log9 = require("@dxos/log");
|
|
1839
1847
|
var import_util6 = require("@dxos/util");
|
|
1840
|
-
|
|
1848
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
1841
1849
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1842
1850
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1843
1851
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1846,7 +1854,8 @@ var __decorate4 = function(decorators, target, key, desc) {
|
|
|
1846
1854
|
if (d = decorators[i])
|
|
1847
1855
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1848
1856
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1849
|
-
}
|
|
1857
|
+
}
|
|
1858
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/memory-transport.ts";
|
|
1850
1859
|
var MEMORY_TRANSPORT_DELAY = 1;
|
|
1851
1860
|
var createStreamDelay = (delay) => {
|
|
1852
1861
|
return new import_node_stream.Transform({
|
|
@@ -1866,26 +1875,26 @@ var _MemoryTransport = class {
|
|
|
1866
1875
|
this.closed = new import_async7.Event();
|
|
1867
1876
|
this.connected = new import_async7.Event();
|
|
1868
1877
|
this.errors = new import_debug4.ErrorStream();
|
|
1878
|
+
this._instanceId = import_keys8.PublicKey.random();
|
|
1869
1879
|
this._remote = new import_async7.Trigger();
|
|
1870
1880
|
this._outgoingDelay = createStreamDelay(MEMORY_TRANSPORT_DELAY);
|
|
1871
1881
|
this._incomingDelay = createStreamDelay(MEMORY_TRANSPORT_DELAY);
|
|
1872
1882
|
this._destroyed = false;
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
callSite: (f, a) => f(...a)
|
|
1883
|
+
(0, import_log9.log)("creating", void 0, {
|
|
1884
|
+
F: __dxlog_file9,
|
|
1885
|
+
L: 64,
|
|
1886
|
+
S: this,
|
|
1887
|
+
C: (f, a) => f(...a)
|
|
1879
1888
|
});
|
|
1880
1889
|
(0, import_tiny_invariant9.default)(!_MemoryTransport._connections.has(this._instanceId), "Duplicate memory connection");
|
|
1881
1890
|
_MemoryTransport._connections.set(this._instanceId, this);
|
|
1882
1891
|
if (this.options.initiator) {
|
|
1883
1892
|
setTimeout(async () => {
|
|
1884
|
-
(0, import_log9.log)("sending signal",
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1893
|
+
(0, import_log9.log)("sending signal", void 0, {
|
|
1894
|
+
F: __dxlog_file9,
|
|
1895
|
+
L: 73,
|
|
1896
|
+
S: this,
|
|
1897
|
+
C: (f, a) => f(...a)
|
|
1889
1898
|
});
|
|
1890
1899
|
void this.options.sendSignal({
|
|
1891
1900
|
payload: {
|
|
@@ -1914,11 +1923,11 @@ var _MemoryTransport = class {
|
|
|
1914
1923
|
(0, import_tiny_invariant9.default)(!this._remoteConnection._remoteConnection, `Remote already connected: ${this._remoteInstanceId}`);
|
|
1915
1924
|
this._remoteConnection._remoteConnection = this;
|
|
1916
1925
|
this._remoteConnection._remoteInstanceId = this._instanceId;
|
|
1917
|
-
(0, import_log9.log)("connected",
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1926
|
+
(0, import_log9.log)("connected", void 0, {
|
|
1927
|
+
F: __dxlog_file9,
|
|
1928
|
+
L: 103,
|
|
1929
|
+
S: this,
|
|
1930
|
+
C: (f, a) => f(...a)
|
|
1922
1931
|
});
|
|
1923
1932
|
this.options.stream.pipe(this._outgoingDelay).pipe(this._remoteConnection.options.stream).pipe(this._incomingDelay).pipe(this.options.stream);
|
|
1924
1933
|
this.connected.emit();
|
|
@@ -1932,20 +1941,20 @@ var _MemoryTransport = class {
|
|
|
1932
1941
|
}
|
|
1933
1942
|
}
|
|
1934
1943
|
async destroy() {
|
|
1935
|
-
(0, import_log9.log)("closing",
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1944
|
+
(0, import_log9.log)("closing", void 0, {
|
|
1945
|
+
F: __dxlog_file9,
|
|
1946
|
+
L: 124,
|
|
1947
|
+
S: this,
|
|
1948
|
+
C: (f, a) => f(...a)
|
|
1940
1949
|
});
|
|
1941
1950
|
this._destroyed = true;
|
|
1942
1951
|
_MemoryTransport._connections.delete(this._instanceId);
|
|
1943
1952
|
if (this._remoteConnection) {
|
|
1944
|
-
(0, import_log9.log)("closing",
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1953
|
+
(0, import_log9.log)("closing", void 0, {
|
|
1954
|
+
F: __dxlog_file9,
|
|
1955
|
+
L: 129,
|
|
1956
|
+
S: this,
|
|
1957
|
+
C: (f, a) => f(...a)
|
|
1949
1958
|
});
|
|
1950
1959
|
this._remoteConnection._destroyed = true;
|
|
1951
1960
|
_MemoryTransport._connections.delete(this._remoteInstanceId);
|
|
@@ -1954,29 +1963,29 @@ var _MemoryTransport = class {
|
|
|
1954
1963
|
this._remoteConnection.closed.emit();
|
|
1955
1964
|
this._remoteConnection._remoteConnection = void 0;
|
|
1956
1965
|
this._remoteConnection = void 0;
|
|
1957
|
-
(0, import_log9.log)("closed",
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1966
|
+
(0, import_log9.log)("closed", void 0, {
|
|
1967
|
+
F: __dxlog_file9,
|
|
1968
|
+
L: 147,
|
|
1969
|
+
S: this,
|
|
1970
|
+
C: (f, a) => f(...a)
|
|
1962
1971
|
});
|
|
1963
1972
|
}
|
|
1964
1973
|
this.closed.emit();
|
|
1965
|
-
(0, import_log9.log)("closed",
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1974
|
+
(0, import_log9.log)("closed", void 0, {
|
|
1975
|
+
F: __dxlog_file9,
|
|
1976
|
+
L: 151,
|
|
1977
|
+
S: this,
|
|
1978
|
+
C: (f, a) => f(...a)
|
|
1970
1979
|
});
|
|
1971
1980
|
}
|
|
1972
1981
|
signal({ payload }) {
|
|
1973
1982
|
(0, import_log9.log)("received signal", {
|
|
1974
1983
|
payload
|
|
1975
1984
|
}, {
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1985
|
+
F: __dxlog_file9,
|
|
1986
|
+
L: 155,
|
|
1987
|
+
S: this,
|
|
1988
|
+
C: (f, a) => f(...a)
|
|
1980
1989
|
});
|
|
1981
1990
|
if (!(payload == null ? void 0 : payload.transportId)) {
|
|
1982
1991
|
return;
|
|
@@ -1991,10 +2000,10 @@ var _MemoryTransport = class {
|
|
|
1991
2000
|
var MemoryTransport = _MemoryTransport;
|
|
1992
2001
|
// TODO(burdon): Remove static properties (inject context into constructor).
|
|
1993
2002
|
MemoryTransport._connections = new import_util6.ComplexMap(import_keys8.PublicKey.hash);
|
|
1994
|
-
|
|
2003
|
+
_ts_decorate4([
|
|
1995
2004
|
import_log9.logInfo
|
|
1996
2005
|
], MemoryTransport.prototype, "_instanceId", void 0);
|
|
1997
|
-
|
|
2006
|
+
_ts_decorate4([
|
|
1998
2007
|
import_log9.logInfo
|
|
1999
2008
|
], MemoryTransport.prototype, "_remoteInstanceId", void 0);
|
|
2000
2009
|
|
|
@@ -2015,6 +2024,7 @@ try {
|
|
|
2015
2024
|
}
|
|
2016
2025
|
|
|
2017
2026
|
// packages/core/mesh/network-manager/src/transport/webrtc-transport.ts
|
|
2027
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/webrtc-transport.ts";
|
|
2018
2028
|
var WebRTCTransport = class {
|
|
2019
2029
|
constructor(params) {
|
|
2020
2030
|
var _a;
|
|
@@ -2027,16 +2037,16 @@ var WebRTCTransport = class {
|
|
|
2027
2037
|
import_log10.log.trace("dxos.mesh.webrtc-transport.constructor", import_protocols5.trace.begin({
|
|
2028
2038
|
id: this._instanceId
|
|
2029
2039
|
}), {
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2040
|
+
F: __dxlog_file10,
|
|
2041
|
+
L: 39,
|
|
2042
|
+
S: this,
|
|
2043
|
+
C: (f, a) => f(...a)
|
|
2034
2044
|
});
|
|
2035
2045
|
(0, import_log10.log)("created connection", params, {
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2046
|
+
F: __dxlog_file10,
|
|
2047
|
+
L: 40,
|
|
2048
|
+
S: this,
|
|
2049
|
+
C: (f, a) => f(...a)
|
|
2040
2050
|
});
|
|
2041
2051
|
this._peer = new import_simple_peer.default({
|
|
2042
2052
|
initiator: this.params.initiator,
|
|
@@ -2045,10 +2055,10 @@ var WebRTCTransport = class {
|
|
|
2045
2055
|
});
|
|
2046
2056
|
this._peer.on("signal", async (data) => {
|
|
2047
2057
|
(0, import_log10.log)("signal", data, {
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2058
|
+
F: __dxlog_file10,
|
|
2059
|
+
L: 48,
|
|
2060
|
+
S: this,
|
|
2061
|
+
C: (f, a) => f(...a)
|
|
2052
2062
|
});
|
|
2053
2063
|
await this.params.sendSignal({
|
|
2054
2064
|
payload: {
|
|
@@ -2057,21 +2067,21 @@ var WebRTCTransport = class {
|
|
|
2057
2067
|
});
|
|
2058
2068
|
});
|
|
2059
2069
|
this._peer.on("connect", () => {
|
|
2060
|
-
(0, import_log10.log)("connected",
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2070
|
+
(0, import_log10.log)("connected", void 0, {
|
|
2071
|
+
F: __dxlog_file10,
|
|
2072
|
+
L: 53,
|
|
2073
|
+
S: this,
|
|
2074
|
+
C: (f, a) => f(...a)
|
|
2065
2075
|
});
|
|
2066
2076
|
this.params.stream.pipe(this._peer).pipe(this.params.stream);
|
|
2067
2077
|
this.connected.emit();
|
|
2068
2078
|
});
|
|
2069
2079
|
this._peer.on("close", async () => {
|
|
2070
|
-
(0, import_log10.log)("closed",
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2080
|
+
(0, import_log10.log)("closed", void 0, {
|
|
2081
|
+
F: __dxlog_file10,
|
|
2082
|
+
L: 59,
|
|
2083
|
+
S: this,
|
|
2084
|
+
C: (f, a) => f(...a)
|
|
2075
2085
|
});
|
|
2076
2086
|
await this._disconnectStreams();
|
|
2077
2087
|
this.closed.emit();
|
|
@@ -2086,10 +2096,10 @@ var WebRTCTransport = class {
|
|
|
2086
2096
|
config: this.params.webrtcConfig,
|
|
2087
2097
|
stats
|
|
2088
2098
|
}, {
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2099
|
+
F: __dxlog_file10,
|
|
2100
|
+
L: 71,
|
|
2101
|
+
S: this,
|
|
2102
|
+
C: (f, a) => f(...a)
|
|
2093
2103
|
});
|
|
2094
2104
|
});
|
|
2095
2105
|
}
|
|
@@ -2100,28 +2110,28 @@ var WebRTCTransport = class {
|
|
|
2100
2110
|
import_log10.log.trace("dxos.mesh.webrtc-transport.constructor", import_protocols5.trace.end({
|
|
2101
2111
|
id: this._instanceId
|
|
2102
2112
|
}), {
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2113
|
+
F: __dxlog_file10,
|
|
2114
|
+
L: 81,
|
|
2115
|
+
S: this,
|
|
2116
|
+
C: (f, a) => f(...a)
|
|
2107
2117
|
});
|
|
2108
2118
|
}
|
|
2109
2119
|
async destroy() {
|
|
2110
|
-
(0, import_log10.log)("closing...",
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2120
|
+
(0, import_log10.log)("closing...", void 0, {
|
|
2121
|
+
F: __dxlog_file10,
|
|
2122
|
+
L: 85,
|
|
2123
|
+
S: this,
|
|
2124
|
+
C: (f, a) => f(...a)
|
|
2115
2125
|
});
|
|
2116
2126
|
this._closed = true;
|
|
2117
2127
|
await this._disconnectStreams();
|
|
2118
2128
|
this._peer.destroy();
|
|
2119
2129
|
this.closed.emit();
|
|
2120
|
-
(0, import_log10.log)("closed",
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2130
|
+
(0, import_log10.log)("closed", void 0, {
|
|
2131
|
+
F: __dxlog_file10,
|
|
2132
|
+
L: 90,
|
|
2133
|
+
S: this,
|
|
2134
|
+
C: (f, a) => f(...a)
|
|
2125
2135
|
});
|
|
2126
2136
|
}
|
|
2127
2137
|
signal(signal) {
|
|
@@ -2151,6 +2161,7 @@ var import_keys10 = require("@dxos/keys");
|
|
|
2151
2161
|
var import_log11 = require("@dxos/log");
|
|
2152
2162
|
var import_bridge = require("@dxos/protocols/proto/dxos/mesh/bridge");
|
|
2153
2163
|
var import_util7 = require("@dxos/util");
|
|
2164
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/webrtc-transport-service.ts";
|
|
2154
2165
|
var WebRTCTransportService = class {
|
|
2155
2166
|
// prettier-ignore
|
|
2156
2167
|
constructor(_webrtcConfig) {
|
|
@@ -2233,11 +2244,11 @@ var WebRTCTransportService = class {
|
|
|
2233
2244
|
await ((_a = this.transports.get(proxyId)) == null ? void 0 : _a.transport.destroy());
|
|
2234
2245
|
await ((_b = this.transports.get(proxyId)) == null ? void 0 : _b.stream.end());
|
|
2235
2246
|
this.transports.delete(proxyId);
|
|
2236
|
-
(0, import_log11.log)("Closed.",
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2247
|
+
(0, import_log11.log)("Closed.", void 0, {
|
|
2248
|
+
F: __dxlog_file11,
|
|
2249
|
+
L: 109,
|
|
2250
|
+
S: this,
|
|
2251
|
+
C: (f, a) => f(...a)
|
|
2241
2252
|
});
|
|
2242
2253
|
}
|
|
2243
2254
|
};
|
|
@@ -2251,6 +2262,7 @@ var import_keys11 = require("@dxos/keys");
|
|
|
2251
2262
|
var import_log12 = require("@dxos/log");
|
|
2252
2263
|
var import_bridge2 = require("@dxos/protocols/proto/dxos/mesh/bridge");
|
|
2253
2264
|
var import_util8 = require("@dxos/util");
|
|
2265
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/webrtc-transport-proxy.ts";
|
|
2254
2266
|
var WebRTCTransportProxy = class {
|
|
2255
2267
|
// prettier-ignore
|
|
2256
2268
|
constructor(_params) {
|
|
@@ -2268,10 +2280,10 @@ var WebRTCTransportProxy = class {
|
|
|
2268
2280
|
this._serviceStream.waitUntilReady().then(() => {
|
|
2269
2281
|
this._serviceStream.subscribe(async (event) => {
|
|
2270
2282
|
(0, import_log12.log)("WebRTCTransportProxy: event", event, {
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2283
|
+
F: __dxlog_file12,
|
|
2284
|
+
L: 50,
|
|
2285
|
+
S: this,
|
|
2286
|
+
C: (f, a) => f(...a)
|
|
2275
2287
|
});
|
|
2276
2288
|
if (event.connection) {
|
|
2277
2289
|
await this._handleConnection(event.connection);
|
|
@@ -2288,11 +2300,11 @@ var WebRTCTransportProxy = class {
|
|
|
2288
2300
|
payload: data
|
|
2289
2301
|
});
|
|
2290
2302
|
} catch (err) {
|
|
2291
|
-
import_log12.log.catch(err,
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2303
|
+
import_log12.log.catch(err, void 0, {
|
|
2304
|
+
F: __dxlog_file12,
|
|
2305
|
+
L: 67,
|
|
2306
|
+
S: this,
|
|
2307
|
+
C: (f, a) => f(...a)
|
|
2296
2308
|
});
|
|
2297
2309
|
}
|
|
2298
2310
|
};
|
|
@@ -2300,11 +2312,11 @@ var WebRTCTransportProxy = class {
|
|
|
2300
2312
|
this._ctx.onDispose(() => {
|
|
2301
2313
|
this._params.stream.off("data", dataListener);
|
|
2302
2314
|
});
|
|
2303
|
-
}, (error) => import_log12.log.catch(error,
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2315
|
+
}, (error) => import_log12.log.catch(error, void 0, {
|
|
2316
|
+
F: __dxlog_file12,
|
|
2317
|
+
L: 73,
|
|
2318
|
+
S: this,
|
|
2319
|
+
C: (f, a) => f(...a)
|
|
2308
2320
|
}));
|
|
2309
2321
|
}
|
|
2310
2322
|
async _handleConnection(connectionEvent) {
|
|
@@ -2346,11 +2358,11 @@ var WebRTCTransportProxy = class {
|
|
|
2346
2358
|
proxyId: this._proxyId
|
|
2347
2359
|
});
|
|
2348
2360
|
} catch (err) {
|
|
2349
|
-
import_log12.log.catch(err,
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2361
|
+
import_log12.log.catch(err, void 0, {
|
|
2362
|
+
F: __dxlog_file12,
|
|
2363
|
+
L: 124,
|
|
2364
|
+
S: this,
|
|
2365
|
+
C: (f, a) => f(...a)
|
|
2354
2366
|
});
|
|
2355
2367
|
}
|
|
2356
2368
|
this.closed.emit();
|