@dxos/network-manager 0.1.53 → 0.1.54-main.a3a8e76
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-6CP5XM3F.mjs → chunk-HDCPX2MD.mjs} +512 -499
- package/dist/lib/browser/chunk-HDCPX2MD.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 +34 -11
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +510 -497
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +488 -452
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/signal/swarm-messenger.d.ts.map +1 -1
- package/dist/types/src/testing/test-wire-protocol.d.ts +4 -1
- package/dist/types/src/testing/test-wire-protocol.d.ts.map +1 -1
- package/dist/types/src/transport/memory-transport.d.ts.map +1 -1
- package/package.json +19 -18
- package/src/network-manager.ts +5 -5
- package/src/signal/swarm-messenger.ts +11 -9
- package/src/swarm/connection.ts +9 -9
- package/src/swarm/peer.ts +6 -6
- package/src/swarm/swarm.ts +8 -8
- package/src/testing/test-wire-protocol.ts +32 -1
- package/src/topology/fully-connected-topology.ts +3 -3
- package/src/topology/mmst-topology.ts +5 -5
- package/src/topology/star-topology.ts +4 -4
- package/src/transport/memory-transport.ts +3 -6
- package/src/transport/webrtc-transport-proxy.ts +2 -2
- package/src/transport/webrtc-transport-service.ts +3 -3
- package/src/transport/webrtc-transport.ts +2 -2
- package/dist/lib/browser/chunk-6CP5XM3F.mjs.map +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "@dxos/node-std/globals"
|
|
1
|
+
import "@dxos/node-std/globals";
|
|
2
2
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
3
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
4
4
|
}) : x)(function(x) {
|
|
@@ -8,7 +8,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
8
8
|
});
|
|
9
9
|
|
|
10
10
|
// packages/core/mesh/network-manager/src/swarm/connection.ts
|
|
11
|
-
import
|
|
11
|
+
import invariant from "tiny-invariant";
|
|
12
12
|
import { DeferredTask, Event, sleep, synchronized } from "@dxos/async";
|
|
13
13
|
import { Context, cancelWithContext } from "@dxos/context";
|
|
14
14
|
import { ErrorStream } from "@dxos/debug";
|
|
@@ -16,7 +16,7 @@ import { CancelledError } from "@dxos/errors";
|
|
|
16
16
|
import { PublicKey } from "@dxos/keys";
|
|
17
17
|
import { log } from "@dxos/log";
|
|
18
18
|
import { trace } from "@dxos/protocols";
|
|
19
|
-
|
|
19
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
20
20
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
21
21
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
22
22
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -25,7 +25,8 @@ var __decorate = function(decorators, target, key, desc) {
|
|
|
25
25
|
if (d = decorators[i])
|
|
26
26
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
27
27
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
28
|
-
}
|
|
28
|
+
}
|
|
29
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection.ts";
|
|
29
30
|
var STARTING_SIGNALLING_DELAY = 10;
|
|
30
31
|
var MAX_SIGNALLING_DELAY = 300;
|
|
31
32
|
var ConnectionState;
|
|
@@ -98,29 +99,29 @@ var Connection = class {
|
|
|
98
99
|
*/
|
|
99
100
|
// TODO(burdon): Make async?
|
|
100
101
|
openConnection() {
|
|
101
|
-
|
|
102
|
+
invariant(this._state === ConnectionState.INITIAL, "Invalid state.");
|
|
102
103
|
log.trace("dxos.mesh.connection.open-connection", trace.begin({
|
|
103
104
|
id: this._instanceId
|
|
104
105
|
}), {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
F: __dxlog_file,
|
|
107
|
+
L: 115,
|
|
108
|
+
S: this,
|
|
109
|
+
C: (f, a) => f(...a)
|
|
109
110
|
});
|
|
110
111
|
this._changeState(ConnectionState.CONNECTING);
|
|
111
112
|
this._protocol.initialize().catch((err) => {
|
|
112
113
|
this.errors.raise(err);
|
|
113
114
|
});
|
|
114
115
|
this._protocol.stream.on("close", () => {
|
|
115
|
-
log("protocol stream closed",
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
log("protocol stream closed", void 0, {
|
|
117
|
+
F: __dxlog_file,
|
|
118
|
+
L: 126,
|
|
119
|
+
S: this,
|
|
120
|
+
C: (f, a) => f(...a)
|
|
120
121
|
});
|
|
121
122
|
this.close().catch((err) => this.errors.raise(err));
|
|
122
123
|
});
|
|
123
|
-
|
|
124
|
+
invariant(!this._transport);
|
|
124
125
|
this._transport = this._transportFactory.createTransport({
|
|
125
126
|
initiator: this.initiator,
|
|
126
127
|
stream: this._protocol.stream,
|
|
@@ -145,10 +146,10 @@ var Connection = class {
|
|
|
145
146
|
log.trace("dxos.mesh.connection.open-connection", trace.end({
|
|
146
147
|
id: this._instanceId
|
|
147
148
|
}), {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
F: __dxlog_file,
|
|
150
|
+
L: 159,
|
|
151
|
+
S: this,
|
|
152
|
+
C: (f, a) => f(...a)
|
|
152
153
|
});
|
|
153
154
|
}
|
|
154
155
|
async close() {
|
|
@@ -161,38 +162,38 @@ var Connection = class {
|
|
|
161
162
|
log("closing...", {
|
|
162
163
|
peerId: this.ownId
|
|
163
164
|
}, {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
F: __dxlog_file,
|
|
166
|
+
L: 171,
|
|
167
|
+
S: this,
|
|
168
|
+
C: (f, a) => f(...a)
|
|
168
169
|
});
|
|
169
170
|
try {
|
|
170
171
|
await this._protocol.destroy();
|
|
171
172
|
} catch (err) {
|
|
172
|
-
log.catch(err,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
log.catch(err, void 0, {
|
|
174
|
+
F: __dxlog_file,
|
|
175
|
+
L: 177,
|
|
176
|
+
S: this,
|
|
177
|
+
C: (f, a) => f(...a)
|
|
177
178
|
});
|
|
178
179
|
}
|
|
179
180
|
try {
|
|
180
181
|
await ((_a = this._transport) == null ? void 0 : _a.destroy());
|
|
181
|
-
} catch (
|
|
182
|
-
log.catch(
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
182
|
+
} catch (err) {
|
|
183
|
+
log.catch(err, void 0, {
|
|
184
|
+
F: __dxlog_file,
|
|
185
|
+
L: 184,
|
|
186
|
+
S: this,
|
|
187
|
+
C: (f, a) => f(...a)
|
|
187
188
|
});
|
|
188
189
|
}
|
|
189
190
|
log("closed", {
|
|
190
191
|
peerId: this.ownId
|
|
191
192
|
}, {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
F: __dxlog_file,
|
|
194
|
+
L: 187,
|
|
195
|
+
S: this,
|
|
196
|
+
C: (f, a) => f(...a)
|
|
196
197
|
});
|
|
197
198
|
this._changeState(ConnectionState.CLOSED);
|
|
198
199
|
}
|
|
@@ -229,10 +230,10 @@ var Connection = class {
|
|
|
229
230
|
log.warn("Signal failed", {
|
|
230
231
|
err
|
|
231
232
|
}, {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
233
|
+
F: __dxlog_file,
|
|
234
|
+
L: 221,
|
|
235
|
+
S: this,
|
|
236
|
+
C: (f, a) => f(...a)
|
|
236
237
|
});
|
|
237
238
|
await this.close();
|
|
238
239
|
}
|
|
@@ -242,19 +243,19 @@ var Connection = class {
|
|
|
242
243
|
*/
|
|
243
244
|
async signal(msg) {
|
|
244
245
|
var _a, _b, _c;
|
|
245
|
-
|
|
246
|
+
invariant(msg.sessionId);
|
|
246
247
|
if (!msg.sessionId.equals(this.sessionId)) {
|
|
247
|
-
log("dropping signal for incorrect session id",
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
log("dropping signal for incorrect session id", void 0, {
|
|
249
|
+
F: __dxlog_file,
|
|
250
|
+
L: 232,
|
|
251
|
+
S: this,
|
|
252
|
+
C: (f, a) => f(...a)
|
|
252
253
|
});
|
|
253
254
|
return;
|
|
254
255
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
invariant(msg.data.signal || msg.data.signalBatch);
|
|
257
|
+
invariant((_a = msg.author) == null ? void 0 : _a.equals(this.remoteId));
|
|
258
|
+
invariant((_b = msg.recipient) == null ? void 0 : _b.equals(this.ownId));
|
|
258
259
|
const signals = msg.data.signalBatch ? (_c = msg.data.signalBatch.signals) != null ? _c : [] : [
|
|
259
260
|
msg.data.signal
|
|
260
261
|
];
|
|
@@ -268,23 +269,23 @@ var Connection = class {
|
|
|
268
269
|
remoteId: this.remoteId,
|
|
269
270
|
msg: msg.data
|
|
270
271
|
}, {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
F: __dxlog_file,
|
|
273
|
+
L: 246,
|
|
274
|
+
S: this,
|
|
275
|
+
C: (f, a) => f(...a)
|
|
275
276
|
});
|
|
276
277
|
this._incomingSignalBuffer.push(signal);
|
|
277
278
|
} else {
|
|
278
|
-
|
|
279
|
+
invariant(this._transport, "Connection not ready to accept signals.");
|
|
279
280
|
log("received signal", {
|
|
280
281
|
peerId: this.ownId,
|
|
281
282
|
remoteId: this.remoteId,
|
|
282
283
|
msg: msg.data
|
|
283
284
|
}, {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
285
|
+
F: __dxlog_file,
|
|
286
|
+
L: 250,
|
|
287
|
+
S: this,
|
|
288
|
+
C: (f, a) => f(...a)
|
|
288
289
|
});
|
|
289
290
|
await this._transport.signal(signal);
|
|
290
291
|
}
|
|
@@ -296,27 +297,29 @@ var Connection = class {
|
|
|
296
297
|
too: state,
|
|
297
298
|
peerId: this.ownId
|
|
298
299
|
}, {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
300
|
+
F: __dxlog_file,
|
|
301
|
+
L: 257,
|
|
302
|
+
S: this,
|
|
303
|
+
C: (f, a) => f(...a)
|
|
303
304
|
});
|
|
304
|
-
|
|
305
|
+
invariant(state !== this._state, "Already in this state.");
|
|
305
306
|
this._state = state;
|
|
306
307
|
this.stateChanged.emit(state);
|
|
307
308
|
}
|
|
308
309
|
};
|
|
309
|
-
|
|
310
|
+
_ts_decorate([
|
|
310
311
|
synchronized
|
|
311
312
|
], Connection.prototype, "close", null);
|
|
312
313
|
|
|
313
314
|
// packages/core/mesh/network-manager/src/signal/swarm-messenger.ts
|
|
314
|
-
import
|
|
315
|
+
import invariant2 from "tiny-invariant";
|
|
315
316
|
import { Context as Context2 } from "@dxos/context";
|
|
316
317
|
import { PublicKey as PublicKey2 } from "@dxos/keys";
|
|
317
318
|
import { log as log2 } from "@dxos/log";
|
|
318
319
|
import { schema } from "@dxos/protocols";
|
|
319
320
|
import { ComplexMap } from "@dxos/util";
|
|
321
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/signal/swarm-messenger.ts";
|
|
322
|
+
var SwarmMessage = schema.getCodecForType("dxos.mesh.swarm.SwarmMessage");
|
|
320
323
|
var SwarmMessenger = class {
|
|
321
324
|
constructor({ sendMessage, onSignal, onOffer, topic }) {
|
|
322
325
|
this._ctx = new Context2();
|
|
@@ -331,7 +334,7 @@ var SwarmMessenger = class {
|
|
|
331
334
|
if (payload.type_url !== "dxos.mesh.swarm.SwarmMessage") {
|
|
332
335
|
return;
|
|
333
336
|
}
|
|
334
|
-
const message =
|
|
337
|
+
const message = SwarmMessage.decode(payload.value);
|
|
335
338
|
if (!this._topic.equals(message.topic)) {
|
|
336
339
|
return;
|
|
337
340
|
}
|
|
@@ -340,10 +343,10 @@ var SwarmMessenger = class {
|
|
|
340
343
|
to: recipient,
|
|
341
344
|
msg: message
|
|
342
345
|
}, {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
346
|
+
F: __dxlog_file2,
|
|
347
|
+
L: 70,
|
|
348
|
+
S: this,
|
|
349
|
+
C: (f, a) => f(...a)
|
|
347
350
|
});
|
|
348
351
|
if ((_a = message.data) == null ? void 0 : _a.offer) {
|
|
349
352
|
await this._handleOffer({
|
|
@@ -369,16 +372,16 @@ var SwarmMessenger = class {
|
|
|
369
372
|
log2.warn("unknown message", {
|
|
370
373
|
message
|
|
371
374
|
}, {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
375
|
+
F: __dxlog_file2,
|
|
376
|
+
L: 81,
|
|
377
|
+
S: this,
|
|
378
|
+
C: (f, a) => f(...a)
|
|
376
379
|
});
|
|
377
380
|
}
|
|
378
381
|
}
|
|
379
382
|
async signal(message) {
|
|
380
383
|
var _a, _b;
|
|
381
|
-
|
|
384
|
+
invariant2(((_a = message.data) == null ? void 0 : _a.signal) || ((_b = message.data) == null ? void 0 : _b.signalBatch), "Invalid message");
|
|
382
385
|
await this._sendReliableMessage({
|
|
383
386
|
author: message.author,
|
|
384
387
|
recipient: message.recipient,
|
|
@@ -413,40 +416,40 @@ var SwarmMessenger = class {
|
|
|
413
416
|
to: recipient,
|
|
414
417
|
msg: networkMessage
|
|
415
418
|
}, {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
419
|
+
F: __dxlog_file2,
|
|
420
|
+
L: 124,
|
|
421
|
+
S: this,
|
|
422
|
+
C: (f, a) => f(...a)
|
|
420
423
|
});
|
|
421
424
|
await this._sendMessage({
|
|
422
425
|
author,
|
|
423
426
|
recipient,
|
|
424
427
|
payload: {
|
|
425
428
|
type_url: "dxos.mesh.swarm.SwarmMessage",
|
|
426
|
-
value:
|
|
429
|
+
value: SwarmMessage.encode(networkMessage)
|
|
427
430
|
}
|
|
428
431
|
});
|
|
429
432
|
}
|
|
430
433
|
async _resolveAnswers(message) {
|
|
431
434
|
var _a, _b, _c;
|
|
432
|
-
|
|
435
|
+
invariant2((_b = (_a = message.data) == null ? void 0 : _a.answer) == null ? void 0 : _b.offerMessageId, "No offerMessageId");
|
|
433
436
|
const offerRecord = this._offerRecords.get(message.data.answer.offerMessageId);
|
|
434
437
|
if (offerRecord) {
|
|
435
438
|
this._offerRecords.delete(message.data.answer.offerMessageId);
|
|
436
|
-
|
|
439
|
+
invariant2((_c = message.data) == null ? void 0 : _c.answer, "No answer");
|
|
437
440
|
log2("resolving", {
|
|
438
441
|
answer: message.data.answer
|
|
439
442
|
}, {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
443
|
+
F: __dxlog_file2,
|
|
444
|
+
L: 141,
|
|
445
|
+
S: this,
|
|
446
|
+
C: (f, a) => f(...a)
|
|
444
447
|
});
|
|
445
448
|
offerRecord.resolve(message.data.answer);
|
|
446
449
|
}
|
|
447
450
|
}
|
|
448
451
|
async _handleOffer({ author, recipient, message }) {
|
|
449
|
-
|
|
452
|
+
invariant2(message.data.offer, "No offer");
|
|
450
453
|
const offerMessage = {
|
|
451
454
|
author,
|
|
452
455
|
recipient,
|
|
@@ -473,16 +476,16 @@ var SwarmMessenger = class {
|
|
|
473
476
|
log2.warn("error sending answer", {
|
|
474
477
|
err
|
|
475
478
|
}, {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
479
|
+
F: __dxlog_file2,
|
|
480
|
+
L: 175,
|
|
481
|
+
S: this,
|
|
482
|
+
C: (f, a) => f(...a)
|
|
480
483
|
});
|
|
481
484
|
}
|
|
482
485
|
}
|
|
483
486
|
async _handleSignal({ author, recipient, message }) {
|
|
484
|
-
|
|
485
|
-
|
|
487
|
+
invariant2(message.messageId);
|
|
488
|
+
invariant2(message.data.signal || message.data.signalBatch, "Invalid message");
|
|
486
489
|
const signalMessage = {
|
|
487
490
|
author,
|
|
488
491
|
recipient,
|
|
@@ -497,7 +500,7 @@ var SwarmMessenger = class {
|
|
|
497
500
|
};
|
|
498
501
|
|
|
499
502
|
// packages/core/mesh/network-manager/src/swarm/swarm.ts
|
|
500
|
-
import
|
|
503
|
+
import invariant4 from "tiny-invariant";
|
|
501
504
|
import { Event as Event2, scheduleTask as scheduleTask2, sleep as sleep2, synchronized as synchronized3 } from "@dxos/async";
|
|
502
505
|
import { Context as Context4 } from "@dxos/context";
|
|
503
506
|
import { ErrorStream as ErrorStream2 } from "@dxos/debug";
|
|
@@ -507,12 +510,12 @@ import { trace as trace2 } from "@dxos/protocols";
|
|
|
507
510
|
import { ComplexMap as ComplexMap2, isNotNullOrUndefined } from "@dxos/util";
|
|
508
511
|
|
|
509
512
|
// packages/core/mesh/network-manager/src/swarm/peer.ts
|
|
510
|
-
import
|
|
513
|
+
import invariant3 from "tiny-invariant";
|
|
511
514
|
import { scheduleTask, synchronized as synchronized2 } from "@dxos/async";
|
|
512
515
|
import { Context as Context3 } from "@dxos/context";
|
|
513
516
|
import { PublicKey as PublicKey3 } from "@dxos/keys";
|
|
514
517
|
import { log as log3 } from "@dxos/log";
|
|
515
|
-
|
|
518
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
516
519
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
517
520
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
518
521
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -521,7 +524,8 @@ var __decorate2 = function(decorators, target, key, desc) {
|
|
|
521
524
|
if (d = decorators[i])
|
|
522
525
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
523
526
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
524
|
-
}
|
|
527
|
+
}
|
|
528
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/peer.ts";
|
|
525
529
|
var CONNECTION_COUNTS_STABLE_AFTER = 5e3;
|
|
526
530
|
var Peer = class {
|
|
527
531
|
constructor(id, topic, localPeerId, _signalMessaging, _protocolProvider, _transportFactory, _callbacks) {
|
|
@@ -550,10 +554,10 @@ var Peer = class {
|
|
|
550
554
|
topic: this.topic,
|
|
551
555
|
peerId: this.localPeerId
|
|
552
556
|
}, {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
+
F: __dxlog_file3,
|
|
558
|
+
L: 105,
|
|
559
|
+
S: this,
|
|
560
|
+
C: (f, a) => f(...a)
|
|
557
561
|
});
|
|
558
562
|
if (this.connection) {
|
|
559
563
|
await this.closeConnection();
|
|
@@ -566,7 +570,7 @@ var Peer = class {
|
|
|
566
570
|
}
|
|
567
571
|
if (await this._callbacks.onOffer(remoteId)) {
|
|
568
572
|
if (!this.connection) {
|
|
569
|
-
|
|
573
|
+
invariant3(message.sessionId);
|
|
570
574
|
const connection = this._createConnection(false, message.sessionId);
|
|
571
575
|
try {
|
|
572
576
|
connection.openConnection();
|
|
@@ -577,10 +581,10 @@ var Peer = class {
|
|
|
577
581
|
remoteId: this.id,
|
|
578
582
|
err
|
|
579
583
|
}, {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
+
F: __dxlog_file3,
|
|
585
|
+
L: 129,
|
|
586
|
+
S: this,
|
|
587
|
+
C: (f, a) => f(...a)
|
|
584
588
|
});
|
|
585
589
|
await this.closeConnection();
|
|
586
590
|
}
|
|
@@ -597,8 +601,8 @@ var Peer = class {
|
|
|
597
601
|
* Initiate a connection to the remote peer.
|
|
598
602
|
*/
|
|
599
603
|
async initiateConnection() {
|
|
600
|
-
|
|
601
|
-
|
|
604
|
+
invariant3(!this.initiating, "Initiation in progress.");
|
|
605
|
+
invariant3(!this.connection, "Already connected.");
|
|
602
606
|
const sessionId = PublicKey3.random();
|
|
603
607
|
log3("initiating...", {
|
|
604
608
|
id: this.id,
|
|
@@ -606,10 +610,10 @@ var Peer = class {
|
|
|
606
610
|
peerId: this.id,
|
|
607
611
|
sessionId
|
|
608
612
|
}, {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
+
F: __dxlog_file3,
|
|
614
|
+
L: 147,
|
|
615
|
+
S: this,
|
|
616
|
+
C: (f, a) => f(...a)
|
|
613
617
|
});
|
|
614
618
|
const connection = this._createConnection(true, sessionId);
|
|
615
619
|
this.initiating = true;
|
|
@@ -629,17 +633,17 @@ var Peer = class {
|
|
|
629
633
|
ownId: this.localPeerId,
|
|
630
634
|
remoteId: this.id
|
|
631
635
|
}, {
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
+
F: __dxlog_file3,
|
|
637
|
+
L: 159,
|
|
638
|
+
S: this,
|
|
639
|
+
C: (f, a) => f(...a)
|
|
636
640
|
});
|
|
637
641
|
if (connection.state !== ConnectionState.INITIAL) {
|
|
638
|
-
log3("ignoring response",
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
642
|
+
log3("ignoring response", void 0, {
|
|
643
|
+
F: __dxlog_file3,
|
|
644
|
+
L: 161,
|
|
645
|
+
S: this,
|
|
646
|
+
C: (f, a) => f(...a)
|
|
643
647
|
});
|
|
644
648
|
return;
|
|
645
649
|
}
|
|
@@ -656,10 +660,10 @@ var Peer = class {
|
|
|
656
660
|
peerId: this.localPeerId,
|
|
657
661
|
remoteId: this.id
|
|
658
662
|
}, {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
+
F: __dxlog_file3,
|
|
664
|
+
L: 172,
|
|
665
|
+
S: this,
|
|
666
|
+
C: (f, a) => f(...a)
|
|
663
667
|
});
|
|
664
668
|
await this.closeConnection();
|
|
665
669
|
throw err;
|
|
@@ -680,12 +684,12 @@ var Peer = class {
|
|
|
680
684
|
initiator,
|
|
681
685
|
sessionId
|
|
682
686
|
}, {
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
+
F: __dxlog_file3,
|
|
688
|
+
L: 186,
|
|
689
|
+
S: this,
|
|
690
|
+
C: (f, a) => f(...a)
|
|
687
691
|
});
|
|
688
|
-
|
|
692
|
+
invariant3(!this.connection, "Already connected.");
|
|
689
693
|
const connection = new Connection(
|
|
690
694
|
this.topic,
|
|
691
695
|
this.localPeerId,
|
|
@@ -720,12 +724,12 @@ var Peer = class {
|
|
|
720
724
|
remoteId: this.id,
|
|
721
725
|
initiator
|
|
722
726
|
}, {
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
+
F: __dxlog_file3,
|
|
728
|
+
L: 221,
|
|
729
|
+
S: this,
|
|
730
|
+
C: (f, a) => f(...a)
|
|
727
731
|
});
|
|
728
|
-
|
|
732
|
+
invariant3(this.connection === connection, "Connection mismatch (race condition).");
|
|
729
733
|
if (this._lastConnectionTime && this._lastConnectionTime + CONNECTION_COUNTS_STABLE_AFTER < Date.now()) {
|
|
730
734
|
this._availableAfter = 0;
|
|
731
735
|
} else {
|
|
@@ -750,10 +754,10 @@ var Peer = class {
|
|
|
750
754
|
initiator,
|
|
751
755
|
err
|
|
752
756
|
}, {
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
+
F: __dxlog_file3,
|
|
758
|
+
L: 249,
|
|
759
|
+
S: this,
|
|
760
|
+
C: (f, a) => f(...a)
|
|
757
761
|
});
|
|
758
762
|
void this.closeConnection();
|
|
759
763
|
});
|
|
@@ -769,20 +773,20 @@ var Peer = class {
|
|
|
769
773
|
peerId: this.id,
|
|
770
774
|
sessionId: connection.sessionId
|
|
771
775
|
}, {
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
+
F: __dxlog_file3,
|
|
777
|
+
L: 265,
|
|
778
|
+
S: this,
|
|
779
|
+
C: (f, a) => f(...a)
|
|
776
780
|
});
|
|
777
781
|
await connection.close();
|
|
778
782
|
log3("closed", {
|
|
779
783
|
peerId: this.id,
|
|
780
784
|
sessionId: connection.sessionId
|
|
781
785
|
}, {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
+
F: __dxlog_file3,
|
|
787
|
+
L: 271,
|
|
788
|
+
S: this,
|
|
789
|
+
C: (f, a) => f(...a)
|
|
786
790
|
});
|
|
787
791
|
}
|
|
788
792
|
async onSignal(message) {
|
|
@@ -790,10 +794,10 @@ var Peer = class {
|
|
|
790
794
|
log3("dropping signal message for non-existent connection", {
|
|
791
795
|
message
|
|
792
796
|
}, {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
+
F: __dxlog_file3,
|
|
798
|
+
L: 276,
|
|
799
|
+
S: this,
|
|
800
|
+
C: (f, a) => f(...a)
|
|
797
801
|
});
|
|
798
802
|
return;
|
|
799
803
|
}
|
|
@@ -806,15 +810,15 @@ var Peer = class {
|
|
|
806
810
|
peerId: this.id,
|
|
807
811
|
topic: this.topic
|
|
808
812
|
}, {
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
+
F: __dxlog_file3,
|
|
814
|
+
L: 285,
|
|
815
|
+
S: this,
|
|
816
|
+
C: (f, a) => f(...a)
|
|
813
817
|
});
|
|
814
818
|
await ((_a = this == null ? void 0 : this.connection) == null ? void 0 : _a.close());
|
|
815
819
|
}
|
|
816
820
|
};
|
|
817
|
-
|
|
821
|
+
_ts_decorate2([
|
|
818
822
|
synchronized2
|
|
819
823
|
], Peer.prototype, "destroy", null);
|
|
820
824
|
var increaseInterval = (interval) => {
|
|
@@ -831,7 +835,7 @@ var increaseInterval = (interval) => {
|
|
|
831
835
|
};
|
|
832
836
|
|
|
833
837
|
// packages/core/mesh/network-manager/src/swarm/swarm.ts
|
|
834
|
-
|
|
838
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
835
839
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
836
840
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
837
841
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -840,7 +844,8 @@ var __decorate3 = function(decorators, target, key, desc) {
|
|
|
840
844
|
if (d = decorators[i])
|
|
841
845
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
842
846
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
843
|
-
}
|
|
847
|
+
}
|
|
848
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/swarm.ts";
|
|
844
849
|
var INITIATION_DELAY = 100;
|
|
845
850
|
var getClassName = (obj) => Object.getPrototypeOf(obj).constructor.name;
|
|
846
851
|
var Swarm = class {
|
|
@@ -857,11 +862,11 @@ var Swarm = class {
|
|
|
857
862
|
this._peers = new ComplexMap2(PublicKey4.hash);
|
|
858
863
|
this._ctx = new Context4();
|
|
859
864
|
this._listeningHandle = void 0;
|
|
865
|
+
this._instanceId = PublicKey4.random().toHex();
|
|
860
866
|
this.connectionAdded = new Event2();
|
|
861
867
|
this.disconnected = new Event2();
|
|
862
868
|
this.connected = new Event2();
|
|
863
869
|
this.errors = new ErrorStream2();
|
|
864
|
-
this._instanceId = PublicKey4.random().toHex();
|
|
865
870
|
log4.trace("dxos.mesh.swarm.constructor", trace2.begin({
|
|
866
871
|
id: this._instanceId,
|
|
867
872
|
data: {
|
|
@@ -869,18 +874,18 @@ var Swarm = class {
|
|
|
869
874
|
peerId: this._ownPeerId.toHex()
|
|
870
875
|
}
|
|
871
876
|
}), {
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
877
|
+
F: __dxlog_file4,
|
|
878
|
+
L: 86,
|
|
879
|
+
S: this,
|
|
880
|
+
C: (f, a) => f(...a)
|
|
876
881
|
});
|
|
877
882
|
log4("creating swarm", {
|
|
878
883
|
peerId: _ownPeerId
|
|
879
884
|
}, {
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
885
|
+
F: __dxlog_file4,
|
|
886
|
+
L: 90,
|
|
887
|
+
S: this,
|
|
888
|
+
C: (f, a) => f(...a)
|
|
884
889
|
});
|
|
885
890
|
_topology.init(this._getSwarmController());
|
|
886
891
|
this._swarmMessenger = new SwarmMessenger({
|
|
@@ -892,10 +897,10 @@ var Swarm = class {
|
|
|
892
897
|
log4.trace("dxos.mesh.swarm.constructor", trace2.end({
|
|
893
898
|
id: this._instanceId
|
|
894
899
|
}), {
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
900
|
+
F: __dxlog_file4,
|
|
901
|
+
L: 99,
|
|
902
|
+
S: this,
|
|
903
|
+
C: (f, a) => f(...a)
|
|
899
904
|
});
|
|
900
905
|
}
|
|
901
906
|
get connections() {
|
|
@@ -914,7 +919,7 @@ var Swarm = class {
|
|
|
914
919
|
return this._topic;
|
|
915
920
|
}
|
|
916
921
|
async open() {
|
|
917
|
-
|
|
922
|
+
invariant4(!this._listeningHandle);
|
|
918
923
|
this._listeningHandle = await this._messenger.listen({
|
|
919
924
|
peerId: this._ownPeerId,
|
|
920
925
|
payloadType: "dxos.mesh.swarm.SwarmMessage",
|
|
@@ -922,36 +927,36 @@ var Swarm = class {
|
|
|
922
927
|
await this._swarmMessenger.receiveMessage(message).catch((err) => log4.warn("Error while receiving message", {
|
|
923
928
|
err
|
|
924
929
|
}, {
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
930
|
+
F: __dxlog_file4,
|
|
931
|
+
L: 133,
|
|
932
|
+
S: this,
|
|
933
|
+
C: (f, a) => f(...a)
|
|
929
934
|
}));
|
|
930
935
|
}
|
|
931
936
|
});
|
|
932
937
|
}
|
|
933
938
|
async destroy() {
|
|
934
939
|
var _a;
|
|
935
|
-
log4("destroying...",
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
+
log4("destroying...", void 0, {
|
|
941
|
+
F: __dxlog_file4,
|
|
942
|
+
L: 139,
|
|
943
|
+
S: this,
|
|
944
|
+
C: (f, a) => f(...a)
|
|
940
945
|
});
|
|
941
946
|
await ((_a = this._listeningHandle) == null ? void 0 : _a.unsubscribe());
|
|
942
947
|
this._listeningHandle = void 0;
|
|
943
948
|
await this._ctx.dispose();
|
|
944
949
|
await this._topology.destroy();
|
|
945
950
|
await Promise.all(Array.from(this._peers.keys()).map((key) => this._destroyPeer(key)));
|
|
946
|
-
log4("destroyed",
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
+
log4("destroyed", void 0, {
|
|
952
|
+
F: __dxlog_file4,
|
|
953
|
+
L: 146,
|
|
954
|
+
S: this,
|
|
955
|
+
C: (f, a) => f(...a)
|
|
951
956
|
});
|
|
952
957
|
}
|
|
953
958
|
async setTopology(topology) {
|
|
954
|
-
|
|
959
|
+
invariant4(!this._ctx.disposed, "Swarm is offline");
|
|
955
960
|
if (topology === this._topology) {
|
|
956
961
|
return;
|
|
957
962
|
}
|
|
@@ -959,10 +964,10 @@ var Swarm = class {
|
|
|
959
964
|
previous: getClassName(this._topology),
|
|
960
965
|
topology: getClassName(topology)
|
|
961
966
|
}, {
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
967
|
+
F: __dxlog_file4,
|
|
968
|
+
L: 154,
|
|
969
|
+
S: this,
|
|
970
|
+
C: (f, a) => f(...a)
|
|
966
971
|
});
|
|
967
972
|
await this._topology.destroy();
|
|
968
973
|
this._topology = topology;
|
|
@@ -974,17 +979,17 @@ var Swarm = class {
|
|
|
974
979
|
log4("swarm event", {
|
|
975
980
|
swarmEvent
|
|
976
981
|
}, {
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
982
|
+
F: __dxlog_file4,
|
|
983
|
+
L: 167,
|
|
984
|
+
S: this,
|
|
985
|
+
C: (f, a) => f(...a)
|
|
981
986
|
});
|
|
982
987
|
if (this._ctx.disposed) {
|
|
983
|
-
log4("swarm event ignored for disposed swarm",
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
+
log4("swarm event ignored for disposed swarm", void 0, {
|
|
989
|
+
F: __dxlog_file4,
|
|
990
|
+
L: 170,
|
|
991
|
+
S: this,
|
|
992
|
+
C: (f, a) => f(...a)
|
|
988
993
|
});
|
|
989
994
|
return;
|
|
990
995
|
}
|
|
@@ -993,25 +998,25 @@ var Swarm = class {
|
|
|
993
998
|
log4("new peer", {
|
|
994
999
|
peerId
|
|
995
1000
|
}, {
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1001
|
+
F: __dxlog_file4,
|
|
1002
|
+
L: 176,
|
|
1003
|
+
S: this,
|
|
1004
|
+
C: (f, a) => f(...a)
|
|
1000
1005
|
});
|
|
1001
1006
|
if (!peerId.equals(this._ownPeerId)) {
|
|
1002
1007
|
const peer = this._getOrCreatePeer(peerId);
|
|
1003
1008
|
peer.advertizing = true;
|
|
1004
1009
|
}
|
|
1005
1010
|
} else if (swarmEvent.peerLeft) {
|
|
1006
|
-
const
|
|
1007
|
-
if (
|
|
1008
|
-
|
|
1009
|
-
if (((_a =
|
|
1010
|
-
void this._destroyPeer(
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1011
|
+
const peer = this._peers.get(PublicKey4.from(swarmEvent.peerLeft.peer));
|
|
1012
|
+
if (peer) {
|
|
1013
|
+
peer.advertizing = false;
|
|
1014
|
+
if (((_a = peer.connection) == null ? void 0 : _a.state) !== ConnectionState.CONNECTED) {
|
|
1015
|
+
void this._destroyPeer(peer.id).catch((err) => log4.catch(err, void 0, {
|
|
1016
|
+
F: __dxlog_file4,
|
|
1017
|
+
L: 187,
|
|
1018
|
+
S: this,
|
|
1019
|
+
C: (f, a) => f(...a)
|
|
1015
1020
|
}));
|
|
1016
1021
|
}
|
|
1017
1022
|
}
|
|
@@ -1023,31 +1028,31 @@ var Swarm = class {
|
|
|
1023
1028
|
log4("offer", {
|
|
1024
1029
|
message
|
|
1025
1030
|
}, {
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1031
|
+
F: __dxlog_file4,
|
|
1032
|
+
L: 197,
|
|
1033
|
+
S: this,
|
|
1034
|
+
C: (f, a) => f(...a)
|
|
1030
1035
|
});
|
|
1031
1036
|
if (this._ctx.disposed) {
|
|
1032
|
-
log4("ignored for disposed swarm",
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
+
log4("ignored for disposed swarm", void 0, {
|
|
1038
|
+
F: __dxlog_file4,
|
|
1039
|
+
L: 199,
|
|
1040
|
+
S: this,
|
|
1041
|
+
C: (f, a) => f(...a)
|
|
1037
1042
|
});
|
|
1038
1043
|
return {
|
|
1039
1044
|
accept: false
|
|
1040
1045
|
};
|
|
1041
1046
|
}
|
|
1042
|
-
|
|
1047
|
+
invariant4(message.author);
|
|
1043
1048
|
if (!((_a = message.recipient) == null ? void 0 : _a.equals(this._ownPeerId))) {
|
|
1044
1049
|
log4("rejecting offer with incorrect peerId", {
|
|
1045
1050
|
message
|
|
1046
1051
|
}, {
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1052
|
+
F: __dxlog_file4,
|
|
1053
|
+
L: 206,
|
|
1054
|
+
S: this,
|
|
1055
|
+
C: (f, a) => f(...a)
|
|
1051
1056
|
});
|
|
1052
1057
|
return {
|
|
1053
1058
|
accept: false
|
|
@@ -1057,10 +1062,10 @@ var Swarm = class {
|
|
|
1057
1062
|
log4("rejecting offer with incorrect topic", {
|
|
1058
1063
|
message
|
|
1059
1064
|
}, {
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1065
|
+
F: __dxlog_file4,
|
|
1066
|
+
L: 210,
|
|
1067
|
+
S: this,
|
|
1068
|
+
C: (f, a) => f(...a)
|
|
1064
1069
|
});
|
|
1065
1070
|
return {
|
|
1066
1071
|
accept: false
|
|
@@ -1076,23 +1081,23 @@ var Swarm = class {
|
|
|
1076
1081
|
log4("signal", {
|
|
1077
1082
|
message
|
|
1078
1083
|
}, {
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1084
|
+
F: __dxlog_file4,
|
|
1085
|
+
L: 222,
|
|
1086
|
+
S: this,
|
|
1087
|
+
C: (f, a) => f(...a)
|
|
1083
1088
|
});
|
|
1084
1089
|
if (this._ctx.disposed) {
|
|
1085
|
-
log4.info("ignored for offline swarm",
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
+
log4.info("ignored for offline swarm", void 0, {
|
|
1091
|
+
F: __dxlog_file4,
|
|
1092
|
+
L: 224,
|
|
1093
|
+
S: this,
|
|
1094
|
+
C: (f, a) => f(...a)
|
|
1090
1095
|
});
|
|
1091
1096
|
return;
|
|
1092
1097
|
}
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1098
|
+
invariant4((_a = message.recipient) == null ? void 0 : _a.equals(this._ownPeerId), `Invalid signal peer id expected=${this.ownPeerId}, actual=${message.recipient}`);
|
|
1099
|
+
invariant4((_b = message.topic) == null ? void 0 : _b.equals(this._topic));
|
|
1100
|
+
invariant4(message.author);
|
|
1096
1101
|
const peer = this._getOrCreatePeer(message.author);
|
|
1097
1102
|
await peer.onSignal(message);
|
|
1098
1103
|
}
|
|
@@ -1144,7 +1149,7 @@ var Swarm = class {
|
|
|
1144
1149
|
return peer;
|
|
1145
1150
|
}
|
|
1146
1151
|
async _destroyPeer(peerId) {
|
|
1147
|
-
|
|
1152
|
+
invariant4(this._peers.has(peerId));
|
|
1148
1153
|
await this._peers.get(peerId).destroy();
|
|
1149
1154
|
this._peers.delete(peerId);
|
|
1150
1155
|
}
|
|
@@ -1164,10 +1169,10 @@ var Swarm = class {
|
|
|
1164
1169
|
await this._initiateConnection(peer);
|
|
1165
1170
|
} catch (err) {
|
|
1166
1171
|
log4("initiation error", err, {
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1172
|
+
F: __dxlog_file4,
|
|
1173
|
+
L: 327,
|
|
1174
|
+
S: this,
|
|
1175
|
+
C: (f, a) => f(...a)
|
|
1171
1176
|
});
|
|
1172
1177
|
}
|
|
1173
1178
|
});
|
|
@@ -1192,10 +1197,10 @@ var Swarm = class {
|
|
|
1192
1197
|
log4("initiation delay", {
|
|
1193
1198
|
remoteId
|
|
1194
1199
|
}, {
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1200
|
+
F: __dxlog_file4,
|
|
1201
|
+
L: 354,
|
|
1202
|
+
S: this,
|
|
1203
|
+
C: (f, a) => f(...a)
|
|
1199
1204
|
});
|
|
1200
1205
|
await sleep2(INITIATION_DELAY);
|
|
1201
1206
|
}
|
|
@@ -1209,20 +1214,20 @@ var Swarm = class {
|
|
|
1209
1214
|
log4("initiating connection...", {
|
|
1210
1215
|
remoteId
|
|
1211
1216
|
}, {
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1217
|
+
F: __dxlog_file4,
|
|
1218
|
+
L: 368,
|
|
1219
|
+
S: this,
|
|
1220
|
+
C: (f, a) => f(...a)
|
|
1216
1221
|
});
|
|
1217
1222
|
await peer.initiateConnection();
|
|
1218
1223
|
this._topology.update();
|
|
1219
1224
|
log4("initiated", {
|
|
1220
1225
|
remoteId
|
|
1221
1226
|
}, {
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1227
|
+
F: __dxlog_file4,
|
|
1228
|
+
L: 371,
|
|
1229
|
+
S: this,
|
|
1230
|
+
C: (f, a) => f(...a)
|
|
1226
1231
|
});
|
|
1227
1232
|
}
|
|
1228
1233
|
async _closeConnection(peerId) {
|
|
@@ -1233,28 +1238,28 @@ var Swarm = class {
|
|
|
1233
1238
|
await peer.closeConnection();
|
|
1234
1239
|
}
|
|
1235
1240
|
};
|
|
1236
|
-
|
|
1241
|
+
_ts_decorate3([
|
|
1237
1242
|
logInfo
|
|
1238
1243
|
], Swarm.prototype, "_instanceId", void 0);
|
|
1239
|
-
|
|
1244
|
+
_ts_decorate3([
|
|
1240
1245
|
logInfo
|
|
1241
1246
|
], Swarm.prototype, "ownPeerId", null);
|
|
1242
|
-
|
|
1247
|
+
_ts_decorate3([
|
|
1243
1248
|
logInfo
|
|
1244
1249
|
], Swarm.prototype, "topic", null);
|
|
1245
|
-
|
|
1250
|
+
_ts_decorate3([
|
|
1246
1251
|
synchronized3
|
|
1247
1252
|
], Swarm.prototype, "onSwarmEvent", null);
|
|
1248
|
-
|
|
1253
|
+
_ts_decorate3([
|
|
1249
1254
|
synchronized3
|
|
1250
1255
|
], Swarm.prototype, "onOffer", null);
|
|
1251
|
-
|
|
1256
|
+
_ts_decorate3([
|
|
1252
1257
|
synchronized3
|
|
1253
1258
|
], Swarm.prototype, "onSignal", null);
|
|
1254
|
-
|
|
1259
|
+
_ts_decorate3([
|
|
1255
1260
|
synchronized3
|
|
1256
1261
|
], Swarm.prototype, "goOffline", null);
|
|
1257
|
-
|
|
1262
|
+
_ts_decorate3([
|
|
1258
1263
|
synchronized3
|
|
1259
1264
|
], Swarm.prototype, "goOnline", null);
|
|
1260
1265
|
|
|
@@ -1263,6 +1268,7 @@ import { Event as Event3, EventSubscriptions } from "@dxos/async";
|
|
|
1263
1268
|
import { PublicKey as PublicKey5 } from "@dxos/keys";
|
|
1264
1269
|
import { log as log5 } from "@dxos/log";
|
|
1265
1270
|
import { ComplexMap as ComplexMap3 } from "@dxos/util";
|
|
1271
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/swarm-mapper.ts";
|
|
1266
1272
|
var SwarmMapper = class {
|
|
1267
1273
|
get peers() {
|
|
1268
1274
|
return Array.from(this._peers.values());
|
|
@@ -1289,11 +1295,11 @@ var SwarmMapper = class {
|
|
|
1289
1295
|
this._update();
|
|
1290
1296
|
}
|
|
1291
1297
|
_update() {
|
|
1292
|
-
log5("updating swarm",
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1298
|
+
log5("updating swarm", void 0, {
|
|
1299
|
+
F: __dxlog_file5,
|
|
1300
|
+
L: 75,
|
|
1301
|
+
S: this,
|
|
1302
|
+
C: (f, a) => f(...a)
|
|
1297
1303
|
});
|
|
1298
1304
|
this._peers.clear();
|
|
1299
1305
|
this._peers.set(this._swarm.ownPeerId, {
|
|
@@ -1314,10 +1320,10 @@ var SwarmMapper = class {
|
|
|
1314
1320
|
directConnections: this._swarm.connections.length,
|
|
1315
1321
|
totalPeersInSwarm: this._peers.size
|
|
1316
1322
|
}, {
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1323
|
+
F: __dxlog_file5,
|
|
1324
|
+
L: 116,
|
|
1325
|
+
S: this,
|
|
1326
|
+
C: (f, a) => f(...a)
|
|
1321
1327
|
});
|
|
1322
1328
|
this.mapUpdated.emit(Array.from(this._peers.values()));
|
|
1323
1329
|
}
|
|
@@ -1399,7 +1405,7 @@ var ConnectionLog = class {
|
|
|
1399
1405
|
};
|
|
1400
1406
|
|
|
1401
1407
|
// packages/core/mesh/network-manager/src/network-manager.ts
|
|
1402
|
-
import
|
|
1408
|
+
import invariant5 from "tiny-invariant";
|
|
1403
1409
|
import { Event as Event5 } from "@dxos/async";
|
|
1404
1410
|
import { PublicKey as PublicKey7 } from "@dxos/keys";
|
|
1405
1411
|
import { log as log6 } from "@dxos/log";
|
|
@@ -1407,8 +1413,9 @@ import { Messenger } from "@dxos/messaging";
|
|
|
1407
1413
|
import { trace as trace3 } from "@dxos/protocols";
|
|
1408
1414
|
import { ConnectionState as ConnectionState2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1409
1415
|
import { ComplexMap as ComplexMap5 } from "@dxos/util";
|
|
1416
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/network-manager.ts";
|
|
1410
1417
|
var NetworkManager = class {
|
|
1411
|
-
constructor({ transportFactory, signalManager, log:
|
|
1418
|
+
constructor({ transportFactory, signalManager, log: log1 }) {
|
|
1412
1419
|
this._swarms = new ComplexMap5(PublicKey7.hash);
|
|
1413
1420
|
this._mappers = new ComplexMap5(PublicKey7.hash);
|
|
1414
1421
|
this._connectionState = ConnectionState2.ONLINE;
|
|
@@ -1428,7 +1435,7 @@ var NetworkManager = class {
|
|
|
1428
1435
|
join: (opts) => this._signalManager.join(opts),
|
|
1429
1436
|
leave: (opts) => this._signalManager.leave(opts)
|
|
1430
1437
|
};
|
|
1431
|
-
if (
|
|
1438
|
+
if (log1) {
|
|
1432
1439
|
this._connectionLog = new ConnectionLog();
|
|
1433
1440
|
}
|
|
1434
1441
|
}
|
|
@@ -1453,30 +1460,30 @@ var NetworkManager = class {
|
|
|
1453
1460
|
log6.trace("dxos.mesh.network-manager.open", trace3.begin({
|
|
1454
1461
|
id: this._instanceId
|
|
1455
1462
|
}), {
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1463
|
+
F: __dxlog_file6,
|
|
1464
|
+
L: 127,
|
|
1465
|
+
S: this,
|
|
1466
|
+
C: (f, a) => f(...a)
|
|
1460
1467
|
});
|
|
1461
1468
|
await this._messenger.open();
|
|
1462
1469
|
await this._signalManager.open();
|
|
1463
1470
|
log6.trace("dxos.mesh.network-manager.open", trace3.end({
|
|
1464
1471
|
id: this._instanceId
|
|
1465
1472
|
}), {
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1473
|
+
F: __dxlog_file6,
|
|
1474
|
+
L: 130,
|
|
1475
|
+
S: this,
|
|
1476
|
+
C: (f, a) => f(...a)
|
|
1470
1477
|
});
|
|
1471
1478
|
}
|
|
1472
1479
|
async close() {
|
|
1473
1480
|
for (const topic of this._swarms.keys()) {
|
|
1474
1481
|
await this.leaveSwarm(topic).catch((err) => {
|
|
1475
|
-
log6(err,
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1482
|
+
log6(err, void 0, {
|
|
1483
|
+
F: __dxlog_file6,
|
|
1484
|
+
L: 136,
|
|
1485
|
+
S: this,
|
|
1486
|
+
C: (f, a) => f(...a)
|
|
1480
1487
|
});
|
|
1481
1488
|
});
|
|
1482
1489
|
}
|
|
@@ -1488,10 +1495,10 @@ var NetworkManager = class {
|
|
|
1488
1495
|
*/
|
|
1489
1496
|
async joinSwarm({ topic, peerId, topology, protocolProvider: protocol, label }) {
|
|
1490
1497
|
var _a;
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1498
|
+
invariant5(PublicKey7.isPublicKey(topic));
|
|
1499
|
+
invariant5(PublicKey7.isPublicKey(peerId));
|
|
1500
|
+
invariant5(topology);
|
|
1501
|
+
invariant5(typeof protocol === "function");
|
|
1495
1502
|
if (this._swarms.has(topic)) {
|
|
1496
1503
|
throw new Error(`Already connected to swarm: ${PublicKey7.from(topic)}`);
|
|
1497
1504
|
}
|
|
@@ -1500,20 +1507,20 @@ var NetworkManager = class {
|
|
|
1500
1507
|
peerId,
|
|
1501
1508
|
topology: topology.toString()
|
|
1502
1509
|
}, {
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1510
|
+
F: __dxlog_file6,
|
|
1511
|
+
L: 162,
|
|
1512
|
+
S: this,
|
|
1513
|
+
C: (f, a) => f(...a)
|
|
1507
1514
|
});
|
|
1508
1515
|
const swarm = new Swarm(topic, peerId, topology, protocol, this._messenger, this._transportFactory, label);
|
|
1509
1516
|
swarm.errors.handle((error) => {
|
|
1510
1517
|
log6("swarm error", {
|
|
1511
1518
|
error
|
|
1512
1519
|
}, {
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1520
|
+
F: __dxlog_file6,
|
|
1521
|
+
L: 165,
|
|
1522
|
+
S: this,
|
|
1523
|
+
C: (f, a) => f(...a)
|
|
1517
1524
|
});
|
|
1518
1525
|
});
|
|
1519
1526
|
this._swarms.set(topic, swarm);
|
|
@@ -1522,11 +1529,11 @@ var NetworkManager = class {
|
|
|
1522
1529
|
this._signalConnection.join({
|
|
1523
1530
|
topic,
|
|
1524
1531
|
peerId
|
|
1525
|
-
}).catch((error) => log6.catch(error,
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1532
|
+
}).catch((error) => log6.catch(error, void 0, {
|
|
1533
|
+
F: __dxlog_file6,
|
|
1534
|
+
L: 174,
|
|
1535
|
+
S: this,
|
|
1536
|
+
C: (f, a) => f(...a)
|
|
1530
1537
|
}));
|
|
1531
1538
|
this.topicsUpdated.emit();
|
|
1532
1539
|
(_a = this._connectionLog) == null ? void 0 : _a.joinedSwarm(swarm);
|
|
@@ -1534,10 +1541,10 @@ var NetworkManager = class {
|
|
|
1534
1541
|
topic: PublicKey7.from(topic),
|
|
1535
1542
|
count: this._swarms.size
|
|
1536
1543
|
}, {
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1544
|
+
F: __dxlog_file6,
|
|
1545
|
+
L: 178,
|
|
1546
|
+
S: this,
|
|
1547
|
+
C: (f, a) => f(...a)
|
|
1541
1548
|
});
|
|
1542
1549
|
return {
|
|
1543
1550
|
close: () => this.leaveSwarm(topic)
|
|
@@ -1554,10 +1561,10 @@ var NetworkManager = class {
|
|
|
1554
1561
|
log6("leaving", {
|
|
1555
1562
|
topic: PublicKey7.from(topic)
|
|
1556
1563
|
}, {
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1564
|
+
F: __dxlog_file6,
|
|
1565
|
+
L: 194,
|
|
1566
|
+
S: this,
|
|
1567
|
+
C: (f, a) => f(...a)
|
|
1561
1568
|
});
|
|
1562
1569
|
const swarm = this._swarms.get(topic);
|
|
1563
1570
|
await this._signalConnection.leave({
|
|
@@ -1575,10 +1582,10 @@ var NetworkManager = class {
|
|
|
1575
1582
|
topic: PublicKey7.from(topic),
|
|
1576
1583
|
count: this._swarms.size
|
|
1577
1584
|
}, {
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1585
|
+
F: __dxlog_file6,
|
|
1586
|
+
L: 208,
|
|
1587
|
+
S: this,
|
|
1588
|
+
C: (f, a) => f(...a)
|
|
1582
1589
|
});
|
|
1583
1590
|
}
|
|
1584
1591
|
async setConnectionState(state) {
|
|
@@ -1610,17 +1617,17 @@ var NetworkManager = class {
|
|
|
1610
1617
|
};
|
|
1611
1618
|
|
|
1612
1619
|
// packages/core/mesh/network-manager/src/topology/fully-connected-topology.ts
|
|
1613
|
-
import
|
|
1620
|
+
import invariant6 from "tiny-invariant";
|
|
1614
1621
|
var FullyConnectedTopology = class {
|
|
1615
1622
|
toString() {
|
|
1616
1623
|
return "FullyConnectedTopology";
|
|
1617
1624
|
}
|
|
1618
1625
|
init(controller) {
|
|
1619
|
-
|
|
1626
|
+
invariant6(!this._controller, "Already initialized");
|
|
1620
1627
|
this._controller = controller;
|
|
1621
1628
|
}
|
|
1622
1629
|
update() {
|
|
1623
|
-
|
|
1630
|
+
invariant6(this._controller, "Not initialized");
|
|
1624
1631
|
const { candidates: discovered } = this._controller.getState();
|
|
1625
1632
|
for (const peer of discovered) {
|
|
1626
1633
|
this._controller.connect(peer);
|
|
@@ -1634,9 +1641,10 @@ var FullyConnectedTopology = class {
|
|
|
1634
1641
|
};
|
|
1635
1642
|
|
|
1636
1643
|
// packages/core/mesh/network-manager/src/topology/mmst-topology.ts
|
|
1637
|
-
import
|
|
1644
|
+
import invariant7 from "tiny-invariant";
|
|
1638
1645
|
import distance from "xor-distance";
|
|
1639
1646
|
import { log as log7 } from "@dxos/log";
|
|
1647
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/mmst-topology.ts";
|
|
1640
1648
|
var MMSTTopology = class {
|
|
1641
1649
|
constructor({ originateConnections = 2, maxPeers = 4, sampleSize = 10 } = {}) {
|
|
1642
1650
|
this._sampleCollected = false;
|
|
@@ -1645,62 +1653,62 @@ var MMSTTopology = class {
|
|
|
1645
1653
|
this._sampleSize = sampleSize;
|
|
1646
1654
|
}
|
|
1647
1655
|
init(controller) {
|
|
1648
|
-
|
|
1656
|
+
invariant7(!this._controller, "Already initialized");
|
|
1649
1657
|
this._controller = controller;
|
|
1650
1658
|
}
|
|
1651
1659
|
update() {
|
|
1652
|
-
|
|
1660
|
+
invariant7(this._controller, "Not initialized");
|
|
1653
1661
|
const { connected, candidates } = this._controller.getState();
|
|
1654
1662
|
if (this._sampleCollected || connected.length > this._maxPeers || candidates.length > 0) {
|
|
1655
|
-
log7("Running the algorithm.",
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1663
|
+
log7("Running the algorithm.", void 0, {
|
|
1664
|
+
F: __dxlog_file7,
|
|
1665
|
+
L: 55,
|
|
1666
|
+
S: this,
|
|
1667
|
+
C: (f, a) => f(...a)
|
|
1660
1668
|
});
|
|
1661
1669
|
this._sampleCollected = true;
|
|
1662
1670
|
this._runAlgorithm();
|
|
1663
1671
|
}
|
|
1664
1672
|
}
|
|
1665
1673
|
async onOffer(peer) {
|
|
1666
|
-
|
|
1674
|
+
invariant7(this._controller, "Not initialized");
|
|
1667
1675
|
const { connected } = this._controller.getState();
|
|
1668
1676
|
const accept = connected.length < this._maxPeers;
|
|
1669
|
-
log7(`Offer ${peer} accept=${accept}`,
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1677
|
+
log7(`Offer ${peer} accept=${accept}`, void 0, {
|
|
1678
|
+
F: __dxlog_file7,
|
|
1679
|
+
L: 65,
|
|
1680
|
+
S: this,
|
|
1681
|
+
C: (f, a) => f(...a)
|
|
1674
1682
|
});
|
|
1675
1683
|
return accept;
|
|
1676
1684
|
}
|
|
1677
1685
|
async destroy() {
|
|
1678
1686
|
}
|
|
1679
1687
|
_runAlgorithm() {
|
|
1680
|
-
|
|
1688
|
+
invariant7(this._controller, "Not initialized");
|
|
1681
1689
|
const { connected, candidates, ownPeerId } = this._controller.getState();
|
|
1682
1690
|
if (connected.length > this._maxPeers) {
|
|
1683
1691
|
const sorted = sortByXorDistance(connected, ownPeerId).reverse().slice(0, this._maxPeers - connected.length);
|
|
1684
1692
|
for (const peer of sorted) {
|
|
1685
|
-
log7(`Disconnect ${peer}.`,
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1693
|
+
log7(`Disconnect ${peer}.`, void 0, {
|
|
1694
|
+
F: __dxlog_file7,
|
|
1695
|
+
L: 83,
|
|
1696
|
+
S: this,
|
|
1697
|
+
C: (f, a) => f(...a)
|
|
1690
1698
|
});
|
|
1691
1699
|
this._controller.disconnect(peer);
|
|
1692
1700
|
}
|
|
1693
1701
|
} else if (connected.length < this._originateConnections) {
|
|
1694
1702
|
const sample = candidates.sort(() => Math.random() - 0.5).slice(0, this._sampleSize);
|
|
1695
|
-
const
|
|
1696
|
-
for (const
|
|
1697
|
-
log7(`Connect ${
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1703
|
+
const sorted = sortByXorDistance(sample, ownPeerId).slice(0, this._originateConnections - connected.length);
|
|
1704
|
+
for (const peer of sorted) {
|
|
1705
|
+
log7(`Connect ${peer}.`, void 0, {
|
|
1706
|
+
F: __dxlog_file7,
|
|
1707
|
+
L: 91,
|
|
1708
|
+
S: this,
|
|
1709
|
+
C: (f, a) => f(...a)
|
|
1702
1710
|
});
|
|
1703
|
-
this._controller.connect(
|
|
1711
|
+
this._controller.connect(peer);
|
|
1704
1712
|
}
|
|
1705
1713
|
}
|
|
1706
1714
|
}
|
|
@@ -1711,8 +1719,9 @@ var MMSTTopology = class {
|
|
|
1711
1719
|
var sortByXorDistance = (keys, reference) => keys.sort((a, b) => distance.gt(distance(a.asBuffer(), reference.asBuffer()), distance(b.asBuffer(), reference.asBuffer())));
|
|
1712
1720
|
|
|
1713
1721
|
// packages/core/mesh/network-manager/src/topology/star-topology.ts
|
|
1714
|
-
import
|
|
1722
|
+
import invariant8 from "tiny-invariant";
|
|
1715
1723
|
import { log as log8 } from "@dxos/log";
|
|
1724
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/star-topology.ts";
|
|
1716
1725
|
var StarTopology = class {
|
|
1717
1726
|
// prettier-ignore
|
|
1718
1727
|
constructor(_centralPeer) {
|
|
@@ -1722,59 +1731,59 @@ var StarTopology = class {
|
|
|
1722
1731
|
return `StarTopology(${this._centralPeer.truncate()})`;
|
|
1723
1732
|
}
|
|
1724
1733
|
init(controller) {
|
|
1725
|
-
|
|
1734
|
+
invariant8(!this._controller, "Already initialized.");
|
|
1726
1735
|
this._controller = controller;
|
|
1727
1736
|
}
|
|
1728
1737
|
update() {
|
|
1729
|
-
|
|
1738
|
+
invariant8(this._controller, "Not initialized.");
|
|
1730
1739
|
const { candidates, connected, ownPeerId } = this._controller.getState();
|
|
1731
1740
|
if (!ownPeerId.equals(this._centralPeer)) {
|
|
1732
|
-
log8("leaf peer dropping all connections apart from central peer.",
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1741
|
+
log8("leaf peer dropping all connections apart from central peer.", void 0, {
|
|
1742
|
+
F: __dxlog_file8,
|
|
1743
|
+
L: 33,
|
|
1744
|
+
S: this,
|
|
1745
|
+
C: (f, a) => f(...a)
|
|
1737
1746
|
});
|
|
1738
1747
|
for (const peer of connected) {
|
|
1739
1748
|
if (!peer.equals(this._centralPeer)) {
|
|
1740
1749
|
log8("dropping connection", {
|
|
1741
1750
|
peer
|
|
1742
1751
|
}, {
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1752
|
+
F: __dxlog_file8,
|
|
1753
|
+
L: 38,
|
|
1754
|
+
S: this,
|
|
1755
|
+
C: (f, a) => f(...a)
|
|
1747
1756
|
});
|
|
1748
1757
|
this._controller.disconnect(peer);
|
|
1749
1758
|
}
|
|
1750
1759
|
}
|
|
1751
1760
|
}
|
|
1752
|
-
for (const
|
|
1753
|
-
if (
|
|
1761
|
+
for (const peer of candidates) {
|
|
1762
|
+
if (peer.equals(this._centralPeer) || ownPeerId.equals(this._centralPeer)) {
|
|
1754
1763
|
log8("connecting to peer", {
|
|
1755
|
-
peer
|
|
1764
|
+
peer
|
|
1756
1765
|
}, {
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1766
|
+
F: __dxlog_file8,
|
|
1767
|
+
L: 47,
|
|
1768
|
+
S: this,
|
|
1769
|
+
C: (f, a) => f(...a)
|
|
1761
1770
|
});
|
|
1762
|
-
this._controller.connect(
|
|
1771
|
+
this._controller.connect(peer);
|
|
1763
1772
|
}
|
|
1764
1773
|
}
|
|
1765
1774
|
}
|
|
1766
1775
|
async onOffer(peer) {
|
|
1767
|
-
|
|
1776
|
+
invariant8(this._controller, "Not initialized.");
|
|
1768
1777
|
const { ownPeerId } = this._controller.getState();
|
|
1769
1778
|
log8("offer", {
|
|
1770
1779
|
peer,
|
|
1771
1780
|
isCentral: peer.equals(this._centralPeer),
|
|
1772
1781
|
isSelfCentral: ownPeerId.equals(this._centralPeer)
|
|
1773
1782
|
}, {
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1783
|
+
F: __dxlog_file8,
|
|
1784
|
+
L: 56,
|
|
1785
|
+
S: this,
|
|
1786
|
+
C: (f, a) => f(...a)
|
|
1778
1787
|
});
|
|
1779
1788
|
return ownPeerId.equals(this._centralPeer) || peer.equals(this._centralPeer);
|
|
1780
1789
|
}
|
|
@@ -1783,14 +1792,14 @@ var StarTopology = class {
|
|
|
1783
1792
|
};
|
|
1784
1793
|
|
|
1785
1794
|
// packages/core/mesh/network-manager/src/transport/memory-transport.ts
|
|
1786
|
-
import assert9 from "@dxos/node-std/assert";
|
|
1787
1795
|
import { Transform } from "@dxos/node-std/stream";
|
|
1796
|
+
import invariant9 from "tiny-invariant";
|
|
1788
1797
|
import { Event as Event6, Trigger } from "@dxos/async";
|
|
1789
1798
|
import { ErrorStream as ErrorStream3 } from "@dxos/debug";
|
|
1790
1799
|
import { PublicKey as PublicKey8 } from "@dxos/keys";
|
|
1791
1800
|
import { log as log9, logInfo as logInfo2 } from "@dxos/log";
|
|
1792
1801
|
import { ComplexMap as ComplexMap6 } from "@dxos/util";
|
|
1793
|
-
|
|
1802
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
1794
1803
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1795
1804
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1796
1805
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1799,7 +1808,8 @@ var __decorate4 = function(decorators, target, key, desc) {
|
|
|
1799
1808
|
if (d = decorators[i])
|
|
1800
1809
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1801
1810
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1802
|
-
}
|
|
1811
|
+
}
|
|
1812
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/memory-transport.ts";
|
|
1803
1813
|
var MEMORY_TRANSPORT_DELAY = 1;
|
|
1804
1814
|
var createStreamDelay = (delay) => {
|
|
1805
1815
|
return new Transform({
|
|
@@ -1819,26 +1829,26 @@ var _MemoryTransport = class {
|
|
|
1819
1829
|
this.closed = new Event6();
|
|
1820
1830
|
this.connected = new Event6();
|
|
1821
1831
|
this.errors = new ErrorStream3();
|
|
1832
|
+
this._instanceId = PublicKey8.random();
|
|
1822
1833
|
this._remote = new Trigger();
|
|
1823
1834
|
this._outgoingDelay = createStreamDelay(MEMORY_TRANSPORT_DELAY);
|
|
1824
1835
|
this._incomingDelay = createStreamDelay(MEMORY_TRANSPORT_DELAY);
|
|
1825
1836
|
this._destroyed = false;
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
callSite: (f, a) => f(...a)
|
|
1837
|
+
log9("creating", void 0, {
|
|
1838
|
+
F: __dxlog_file9,
|
|
1839
|
+
L: 64,
|
|
1840
|
+
S: this,
|
|
1841
|
+
C: (f, a) => f(...a)
|
|
1832
1842
|
});
|
|
1833
|
-
|
|
1843
|
+
invariant9(!_MemoryTransport._connections.has(this._instanceId), "Duplicate memory connection");
|
|
1834
1844
|
_MemoryTransport._connections.set(this._instanceId, this);
|
|
1835
1845
|
if (this.options.initiator) {
|
|
1836
1846
|
setTimeout(async () => {
|
|
1837
|
-
log9("sending signal",
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1847
|
+
log9("sending signal", void 0, {
|
|
1848
|
+
F: __dxlog_file9,
|
|
1849
|
+
L: 73,
|
|
1850
|
+
S: this,
|
|
1851
|
+
C: (f, a) => f(...a)
|
|
1842
1852
|
});
|
|
1843
1853
|
void this.options.sendSignal({
|
|
1844
1854
|
payload: {
|
|
@@ -1864,14 +1874,14 @@ var _MemoryTransport = class {
|
|
|
1864
1874
|
this.closed.emit();
|
|
1865
1875
|
return;
|
|
1866
1876
|
}
|
|
1867
|
-
|
|
1877
|
+
invariant9(!this._remoteConnection._remoteConnection, `Remote already connected: ${this._remoteInstanceId}`);
|
|
1868
1878
|
this._remoteConnection._remoteConnection = this;
|
|
1869
1879
|
this._remoteConnection._remoteInstanceId = this._instanceId;
|
|
1870
|
-
log9("connected",
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1880
|
+
log9("connected", void 0, {
|
|
1881
|
+
F: __dxlog_file9,
|
|
1882
|
+
L: 103,
|
|
1883
|
+
S: this,
|
|
1884
|
+
C: (f, a) => f(...a)
|
|
1875
1885
|
});
|
|
1876
1886
|
this.options.stream.pipe(this._outgoingDelay).pipe(this._remoteConnection.options.stream).pipe(this._incomingDelay).pipe(this.options.stream);
|
|
1877
1887
|
this.connected.emit();
|
|
@@ -1885,20 +1895,20 @@ var _MemoryTransport = class {
|
|
|
1885
1895
|
}
|
|
1886
1896
|
}
|
|
1887
1897
|
async destroy() {
|
|
1888
|
-
log9("closing",
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1898
|
+
log9("closing", void 0, {
|
|
1899
|
+
F: __dxlog_file9,
|
|
1900
|
+
L: 124,
|
|
1901
|
+
S: this,
|
|
1902
|
+
C: (f, a) => f(...a)
|
|
1893
1903
|
});
|
|
1894
1904
|
this._destroyed = true;
|
|
1895
1905
|
_MemoryTransport._connections.delete(this._instanceId);
|
|
1896
1906
|
if (this._remoteConnection) {
|
|
1897
|
-
log9("closing",
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1907
|
+
log9("closing", void 0, {
|
|
1908
|
+
F: __dxlog_file9,
|
|
1909
|
+
L: 129,
|
|
1910
|
+
S: this,
|
|
1911
|
+
C: (f, a) => f(...a)
|
|
1902
1912
|
});
|
|
1903
1913
|
this._remoteConnection._destroyed = true;
|
|
1904
1914
|
_MemoryTransport._connections.delete(this._remoteInstanceId);
|
|
@@ -1907,29 +1917,29 @@ var _MemoryTransport = class {
|
|
|
1907
1917
|
this._remoteConnection.closed.emit();
|
|
1908
1918
|
this._remoteConnection._remoteConnection = void 0;
|
|
1909
1919
|
this._remoteConnection = void 0;
|
|
1910
|
-
log9("closed",
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1920
|
+
log9("closed", void 0, {
|
|
1921
|
+
F: __dxlog_file9,
|
|
1922
|
+
L: 147,
|
|
1923
|
+
S: this,
|
|
1924
|
+
C: (f, a) => f(...a)
|
|
1915
1925
|
});
|
|
1916
1926
|
}
|
|
1917
1927
|
this.closed.emit();
|
|
1918
|
-
log9("closed",
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1928
|
+
log9("closed", void 0, {
|
|
1929
|
+
F: __dxlog_file9,
|
|
1930
|
+
L: 151,
|
|
1931
|
+
S: this,
|
|
1932
|
+
C: (f, a) => f(...a)
|
|
1923
1933
|
});
|
|
1924
1934
|
}
|
|
1925
1935
|
signal({ payload }) {
|
|
1926
1936
|
log9("received signal", {
|
|
1927
1937
|
payload
|
|
1928
1938
|
}, {
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1939
|
+
F: __dxlog_file9,
|
|
1940
|
+
L: 155,
|
|
1941
|
+
S: this,
|
|
1942
|
+
C: (f, a) => f(...a)
|
|
1933
1943
|
});
|
|
1934
1944
|
if (!(payload == null ? void 0 : payload.transportId)) {
|
|
1935
1945
|
return;
|
|
@@ -1944,16 +1954,16 @@ var _MemoryTransport = class {
|
|
|
1944
1954
|
var MemoryTransport = _MemoryTransport;
|
|
1945
1955
|
// TODO(burdon): Remove static properties (inject context into constructor).
|
|
1946
1956
|
MemoryTransport._connections = new ComplexMap6(PublicKey8.hash);
|
|
1947
|
-
|
|
1957
|
+
_ts_decorate4([
|
|
1948
1958
|
logInfo2
|
|
1949
1959
|
], MemoryTransport.prototype, "_instanceId", void 0);
|
|
1950
|
-
|
|
1960
|
+
_ts_decorate4([
|
|
1951
1961
|
logInfo2
|
|
1952
1962
|
], MemoryTransport.prototype, "_remoteInstanceId", void 0);
|
|
1953
1963
|
|
|
1954
1964
|
// packages/core/mesh/network-manager/src/transport/webrtc-transport.ts
|
|
1955
|
-
import assert10 from "@dxos/node-std/assert";
|
|
1956
1965
|
import SimplePeerConstructor from "simple-peer";
|
|
1966
|
+
import invariant10 from "tiny-invariant";
|
|
1957
1967
|
import { Event as Event7 } from "@dxos/async";
|
|
1958
1968
|
import { ErrorStream as ErrorStream4, raise as raise2 } from "@dxos/debug";
|
|
1959
1969
|
import { PublicKey as PublicKey9 } from "@dxos/keys";
|
|
@@ -1968,6 +1978,7 @@ try {
|
|
|
1968
1978
|
}
|
|
1969
1979
|
|
|
1970
1980
|
// packages/core/mesh/network-manager/src/transport/webrtc-transport.ts
|
|
1981
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/webrtc-transport.ts";
|
|
1971
1982
|
var WebRTCTransport = class {
|
|
1972
1983
|
constructor(params) {
|
|
1973
1984
|
var _a;
|
|
@@ -1980,16 +1991,16 @@ var WebRTCTransport = class {
|
|
|
1980
1991
|
log10.trace("dxos.mesh.webrtc-transport.constructor", trace4.begin({
|
|
1981
1992
|
id: this._instanceId
|
|
1982
1993
|
}), {
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1994
|
+
F: __dxlog_file10,
|
|
1995
|
+
L: 39,
|
|
1996
|
+
S: this,
|
|
1997
|
+
C: (f, a) => f(...a)
|
|
1987
1998
|
});
|
|
1988
1999
|
log10("created connection", params, {
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
2000
|
+
F: __dxlog_file10,
|
|
2001
|
+
L: 40,
|
|
2002
|
+
S: this,
|
|
2003
|
+
C: (f, a) => f(...a)
|
|
1993
2004
|
});
|
|
1994
2005
|
this._peer = new SimplePeerConstructor({
|
|
1995
2006
|
initiator: this.params.initiator,
|
|
@@ -1998,10 +2009,10 @@ var WebRTCTransport = class {
|
|
|
1998
2009
|
});
|
|
1999
2010
|
this._peer.on("signal", async (data) => {
|
|
2000
2011
|
log10("signal", data, {
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2012
|
+
F: __dxlog_file10,
|
|
2013
|
+
L: 48,
|
|
2014
|
+
S: this,
|
|
2015
|
+
C: (f, a) => f(...a)
|
|
2005
2016
|
});
|
|
2006
2017
|
await this.params.sendSignal({
|
|
2007
2018
|
payload: {
|
|
@@ -2010,21 +2021,21 @@ var WebRTCTransport = class {
|
|
|
2010
2021
|
});
|
|
2011
2022
|
});
|
|
2012
2023
|
this._peer.on("connect", () => {
|
|
2013
|
-
log10("connected",
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2024
|
+
log10("connected", void 0, {
|
|
2025
|
+
F: __dxlog_file10,
|
|
2026
|
+
L: 53,
|
|
2027
|
+
S: this,
|
|
2028
|
+
C: (f, a) => f(...a)
|
|
2018
2029
|
});
|
|
2019
2030
|
this.params.stream.pipe(this._peer).pipe(this.params.stream);
|
|
2020
2031
|
this.connected.emit();
|
|
2021
2032
|
});
|
|
2022
2033
|
this._peer.on("close", async () => {
|
|
2023
|
-
log10("closed",
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2034
|
+
log10("closed", void 0, {
|
|
2035
|
+
F: __dxlog_file10,
|
|
2036
|
+
L: 59,
|
|
2037
|
+
S: this,
|
|
2038
|
+
C: (f, a) => f(...a)
|
|
2028
2039
|
});
|
|
2029
2040
|
await this._disconnectStreams();
|
|
2030
2041
|
this.closed.emit();
|
|
@@ -2039,10 +2050,10 @@ var WebRTCTransport = class {
|
|
|
2039
2050
|
config: this.params.webrtcConfig,
|
|
2040
2051
|
stats
|
|
2041
2052
|
}, {
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2053
|
+
F: __dxlog_file10,
|
|
2054
|
+
L: 71,
|
|
2055
|
+
S: this,
|
|
2056
|
+
C: (f, a) => f(...a)
|
|
2046
2057
|
});
|
|
2047
2058
|
});
|
|
2048
2059
|
}
|
|
@@ -2053,35 +2064,35 @@ var WebRTCTransport = class {
|
|
|
2053
2064
|
log10.trace("dxos.mesh.webrtc-transport.constructor", trace4.end({
|
|
2054
2065
|
id: this._instanceId
|
|
2055
2066
|
}), {
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2067
|
+
F: __dxlog_file10,
|
|
2068
|
+
L: 81,
|
|
2069
|
+
S: this,
|
|
2070
|
+
C: (f, a) => f(...a)
|
|
2060
2071
|
});
|
|
2061
2072
|
}
|
|
2062
2073
|
async destroy() {
|
|
2063
|
-
log10("closing...",
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2074
|
+
log10("closing...", void 0, {
|
|
2075
|
+
F: __dxlog_file10,
|
|
2076
|
+
L: 85,
|
|
2077
|
+
S: this,
|
|
2078
|
+
C: (f, a) => f(...a)
|
|
2068
2079
|
});
|
|
2069
2080
|
this._closed = true;
|
|
2070
2081
|
await this._disconnectStreams();
|
|
2071
2082
|
this._peer.destroy();
|
|
2072
2083
|
this.closed.emit();
|
|
2073
|
-
log10("closed",
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2084
|
+
log10("closed", void 0, {
|
|
2085
|
+
F: __dxlog_file10,
|
|
2086
|
+
L: 90,
|
|
2087
|
+
S: this,
|
|
2088
|
+
C: (f, a) => f(...a)
|
|
2078
2089
|
});
|
|
2079
2090
|
}
|
|
2080
2091
|
signal(signal) {
|
|
2081
2092
|
if (this._closed) {
|
|
2082
2093
|
return;
|
|
2083
2094
|
}
|
|
2084
|
-
|
|
2095
|
+
invariant10(signal.payload.data, "Signal message must contain signal data.");
|
|
2085
2096
|
this._peer.signal(signal.payload.data);
|
|
2086
2097
|
}
|
|
2087
2098
|
async _disconnectStreams() {
|
|
@@ -2097,13 +2108,14 @@ var createWebRTCTransportFactory = (webrtcConfig) => ({
|
|
|
2097
2108
|
});
|
|
2098
2109
|
|
|
2099
2110
|
// packages/core/mesh/network-manager/src/transport/webrtc-transport-service.ts
|
|
2100
|
-
import assert11 from "@dxos/node-std/assert";
|
|
2101
2111
|
import { Duplex } from "@dxos/node-std/stream";
|
|
2112
|
+
import invariant11 from "tiny-invariant";
|
|
2102
2113
|
import { Stream } from "@dxos/codec-protobuf";
|
|
2103
2114
|
import { PublicKey as PublicKey10 } from "@dxos/keys";
|
|
2104
2115
|
import { log as log11 } from "@dxos/log";
|
|
2105
2116
|
import { ConnectionState as ConnectionState3 } from "@dxos/protocols/proto/dxos/mesh/bridge";
|
|
2106
2117
|
import { ComplexMap as ComplexMap7 } from "@dxos/util";
|
|
2118
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/webrtc-transport-service.ts";
|
|
2107
2119
|
var WebRTCTransportService = class {
|
|
2108
2120
|
// prettier-ignore
|
|
2109
2121
|
constructor(_webrtcConfig) {
|
|
@@ -2174,11 +2186,11 @@ var WebRTCTransportService = class {
|
|
|
2174
2186
|
return rpcStream;
|
|
2175
2187
|
}
|
|
2176
2188
|
async sendSignal({ proxyId, signal }) {
|
|
2177
|
-
|
|
2189
|
+
invariant11(this.transports.has(proxyId));
|
|
2178
2190
|
await this.transports.get(proxyId).transport.signal(signal);
|
|
2179
2191
|
}
|
|
2180
2192
|
async sendData({ proxyId, payload }) {
|
|
2181
|
-
|
|
2193
|
+
invariant11(this.transports.has(proxyId));
|
|
2182
2194
|
await this.transports.get(proxyId).stream.push(payload);
|
|
2183
2195
|
}
|
|
2184
2196
|
async close({ proxyId }) {
|
|
@@ -2186,17 +2198,17 @@ var WebRTCTransportService = class {
|
|
|
2186
2198
|
await ((_a = this.transports.get(proxyId)) == null ? void 0 : _a.transport.destroy());
|
|
2187
2199
|
await ((_b = this.transports.get(proxyId)) == null ? void 0 : _b.stream.end());
|
|
2188
2200
|
this.transports.delete(proxyId);
|
|
2189
|
-
log11("Closed.",
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2201
|
+
log11("Closed.", void 0, {
|
|
2202
|
+
F: __dxlog_file11,
|
|
2203
|
+
L: 109,
|
|
2204
|
+
S: this,
|
|
2205
|
+
C: (f, a) => f(...a)
|
|
2194
2206
|
});
|
|
2195
2207
|
}
|
|
2196
2208
|
};
|
|
2197
2209
|
|
|
2198
2210
|
// packages/core/mesh/network-manager/src/transport/webrtc-transport-proxy.ts
|
|
2199
|
-
import
|
|
2211
|
+
import invariant12 from "tiny-invariant";
|
|
2200
2212
|
import { Event as Event8 } from "@dxos/async";
|
|
2201
2213
|
import { Context as Context5 } from "@dxos/context";
|
|
2202
2214
|
import { ErrorStream as ErrorStream5 } from "@dxos/debug";
|
|
@@ -2204,6 +2216,7 @@ import { PublicKey as PublicKey11 } from "@dxos/keys";
|
|
|
2204
2216
|
import { log as log12 } from "@dxos/log";
|
|
2205
2217
|
import { ConnectionState as ConnectionState4 } from "@dxos/protocols/proto/dxos/mesh/bridge";
|
|
2206
2218
|
import { arrayToBuffer } from "@dxos/util";
|
|
2219
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/webrtc-transport-proxy.ts";
|
|
2207
2220
|
var WebRTCTransportProxy = class {
|
|
2208
2221
|
// prettier-ignore
|
|
2209
2222
|
constructor(_params) {
|
|
@@ -2221,10 +2234,10 @@ var WebRTCTransportProxy = class {
|
|
|
2221
2234
|
this._serviceStream.waitUntilReady().then(() => {
|
|
2222
2235
|
this._serviceStream.subscribe(async (event) => {
|
|
2223
2236
|
log12("WebRTCTransportProxy: event", event, {
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2237
|
+
F: __dxlog_file12,
|
|
2238
|
+
L: 50,
|
|
2239
|
+
S: this,
|
|
2240
|
+
C: (f, a) => f(...a)
|
|
2228
2241
|
});
|
|
2229
2242
|
if (event.connection) {
|
|
2230
2243
|
await this._handleConnection(event.connection);
|
|
@@ -2241,11 +2254,11 @@ var WebRTCTransportProxy = class {
|
|
|
2241
2254
|
payload: data
|
|
2242
2255
|
});
|
|
2243
2256
|
} catch (err) {
|
|
2244
|
-
log12.catch(err,
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2257
|
+
log12.catch(err, void 0, {
|
|
2258
|
+
F: __dxlog_file12,
|
|
2259
|
+
L: 67,
|
|
2260
|
+
S: this,
|
|
2261
|
+
C: (f, a) => f(...a)
|
|
2249
2262
|
});
|
|
2250
2263
|
}
|
|
2251
2264
|
};
|
|
@@ -2253,11 +2266,11 @@ var WebRTCTransportProxy = class {
|
|
|
2253
2266
|
this._ctx.onDispose(() => {
|
|
2254
2267
|
this._params.stream.off("data", dataListener);
|
|
2255
2268
|
});
|
|
2256
|
-
}, (error) => log12.catch(error,
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2269
|
+
}, (error) => log12.catch(error, void 0, {
|
|
2270
|
+
F: __dxlog_file12,
|
|
2271
|
+
L: 73,
|
|
2272
|
+
S: this,
|
|
2273
|
+
C: (f, a) => f(...a)
|
|
2261
2274
|
}));
|
|
2262
2275
|
}
|
|
2263
2276
|
async _handleConnection(connectionEvent) {
|
|
@@ -2299,11 +2312,11 @@ var WebRTCTransportProxy = class {
|
|
|
2299
2312
|
proxyId: this._proxyId
|
|
2300
2313
|
});
|
|
2301
2314
|
} catch (err) {
|
|
2302
|
-
log12.catch(err,
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2315
|
+
log12.catch(err, void 0, {
|
|
2316
|
+
F: __dxlog_file12,
|
|
2317
|
+
L: 124,
|
|
2318
|
+
S: this,
|
|
2319
|
+
C: (f, a) => f(...a)
|
|
2307
2320
|
});
|
|
2308
2321
|
}
|
|
2309
2322
|
this.closed.emit();
|
|
@@ -2335,7 +2348,7 @@ var WebRTCTransportProxyFactory = class {
|
|
|
2335
2348
|
return this;
|
|
2336
2349
|
}
|
|
2337
2350
|
createTransport(options) {
|
|
2338
|
-
|
|
2351
|
+
invariant12(this._bridgeService, "WebRTCTransportProxyFactory is not ready to open connections");
|
|
2339
2352
|
const transport = new WebRTCTransportProxy({
|
|
2340
2353
|
...options,
|
|
2341
2354
|
bridgeService: this._bridgeService
|
|
@@ -2385,4 +2398,4 @@ export {
|
|
|
2385
2398
|
WebRTCTransportProxyFactory,
|
|
2386
2399
|
createTeleportProtocolFactory
|
|
2387
2400
|
};
|
|
2388
|
-
//# sourceMappingURL=chunk-
|
|
2401
|
+
//# sourceMappingURL=chunk-HDCPX2MD.mjs.map
|