@dxos/network-manager 0.1.41 → 0.1.45-next.45667d4
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-JAQBUAX3.mjs → chunk-UTCOIPSK.mjs} +101 -136
- package/dist/lib/browser/chunk-UTCOIPSK.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +3 -2
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +100 -135
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +102 -136
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/network-manager.d.ts +4 -6
- package/dist/types/src/network-manager.d.ts.map +1 -1
- package/dist/types/src/signal/message-router.d.ts +1 -1
- package/dist/types/src/signal/message-router.d.ts.map +1 -1
- package/dist/types/src/swarm/connection.d.ts +0 -4
- package/dist/types/src/swarm/connection.d.ts.map +1 -1
- package/dist/types/src/swarm/peer.d.ts +0 -1
- package/dist/types/src/swarm/peer.d.ts.map +1 -1
- package/dist/types/src/swarm/swarm-mapper.d.ts +1 -1
- package/dist/types/src/swarm/swarm-mapper.d.ts.map +1 -1
- package/dist/types/src/swarm/swarm.d.ts.map +1 -1
- package/dist/types/src/testing/test-builder.d.ts +1 -1
- package/dist/types/src/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/transport/transport.d.ts +1 -1
- package/dist/types/src/transport/transport.d.ts.map +1 -1
- package/dist/types/src/transport/webrtc-transport-proxy.d.ts +1 -1
- package/dist/types/src/transport/webrtc-transport-proxy.d.ts.map +1 -1
- package/dist/types/src/transport/webrtc-transport.d.ts +1 -2
- package/dist/types/src/transport/webrtc-transport.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/wire-protocol.d.ts +2 -2
- package/dist/types/src/wire-protocol.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/connection-log.ts +4 -4
- package/src/network-manager.ts +6 -14
- package/src/signal/integration.test.ts +19 -19
- package/src/signal/message-router.test.ts +30 -30
- package/src/signal/message-router.ts +15 -15
- package/src/swarm/connection.ts +10 -17
- package/src/swarm/peer.ts +6 -9
- package/src/swarm/swarm-mapper.ts +3 -3
- package/src/swarm/swarm.test.ts +14 -14
- package/src/swarm/swarm.ts +14 -15
- package/src/testing/test-builder.ts +23 -12
- package/src/testing/test-wire-protocol.ts +2 -2
- package/src/tests/basic-test-suite.ts +8 -8
- package/src/tests/memory-transport.test.ts +4 -4
- package/src/tests/property-test-suite.ts +16 -16
- package/src/tests/utils.ts +2 -2
- package/src/tests/webrtc-transport.test.ts +16 -2
- package/src/topology/mmst-topology.ts +1 -1
- package/src/topology/star-topology.ts +1 -1
- package/src/transport/memory-transport.test.ts +4 -4
- package/src/transport/memory-transport.ts +3 -3
- package/src/transport/webrtc-simple-peer.test.ts +1 -1
- package/src/transport/webrtc-transport-proxy.test.ts +18 -18
- package/src/transport/webrtc-transport-proxy.ts +2 -2
- package/src/transport/webrtc-transport-service.ts +13 -13
- package/src/transport/webrtc-transport.test.ts +3 -3
- package/src/transport/webrtc-transport.ts +6 -13
- package/src/wire-protocol.ts +2 -2
- package/dist/lib/browser/chunk-JAQBUAX3.mjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -124,9 +124,6 @@ var Connection = class {
|
|
|
124
124
|
this.stateChanged = new import_async.Event();
|
|
125
125
|
this.errors = new import_debug.ErrorStream();
|
|
126
126
|
this._instanceId = import_keys.PublicKey.random().toHex();
|
|
127
|
-
this._performance = {
|
|
128
|
-
signalsSent: 0
|
|
129
|
-
};
|
|
130
127
|
}
|
|
131
128
|
get state() {
|
|
132
129
|
return this._state;
|
|
@@ -143,23 +140,22 @@ var Connection = class {
|
|
|
143
140
|
// TODO(burdon): Make async?
|
|
144
141
|
openConnection() {
|
|
145
142
|
(0, import_node_assert.default)(this._state === ConnectionState.INITIAL, "Invalid state.");
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
id: this._instanceId,
|
|
149
|
-
parentId: this._traceParent
|
|
143
|
+
import_log.log.trace("dxos.mesh.connection.open-connection", import_protocols.trace.begin({
|
|
144
|
+
id: this._instanceId
|
|
150
145
|
}), {
|
|
151
146
|
file: "connection.ts",
|
|
152
|
-
line:
|
|
147
|
+
line: 92,
|
|
153
148
|
scope: this,
|
|
154
149
|
callSite: (f, a) => f(...a)
|
|
155
150
|
});
|
|
151
|
+
this._changeState(ConnectionState.CONNECTING);
|
|
156
152
|
this._protocol.initialize().catch((err) => {
|
|
157
153
|
this.errors.raise(err);
|
|
158
154
|
});
|
|
159
155
|
this._protocol.stream.on("close", () => {
|
|
160
156
|
(0, import_log.log)("protocol stream closed", {}, {
|
|
161
157
|
file: "connection.ts",
|
|
162
|
-
line:
|
|
158
|
+
line: 103,
|
|
163
159
|
scope: this,
|
|
164
160
|
callSite: (f, a) => f(...a)
|
|
165
161
|
});
|
|
@@ -169,18 +165,15 @@ var Connection = class {
|
|
|
169
165
|
this._transport = this._transportFactory.createTransport({
|
|
170
166
|
initiator: this.initiator,
|
|
171
167
|
stream: this._protocol.stream,
|
|
172
|
-
sendSignal: async (signal) => {
|
|
173
|
-
this.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
}
|
|
168
|
+
sendSignal: async (signal) => this._signalMessaging.signal({
|
|
169
|
+
author: this.ownId,
|
|
170
|
+
recipient: this.remoteId,
|
|
171
|
+
sessionId: this.sessionId,
|
|
172
|
+
topic: this.topic,
|
|
173
|
+
data: {
|
|
174
|
+
signal
|
|
175
|
+
}
|
|
176
|
+
})
|
|
184
177
|
});
|
|
185
178
|
this._transport.connected.once(() => {
|
|
186
179
|
this._changeState(ConnectionState.CONNECTED);
|
|
@@ -198,6 +191,14 @@ var Connection = class {
|
|
|
198
191
|
void this._transport.signal(signal);
|
|
199
192
|
}
|
|
200
193
|
this._bufferedSignals = [];
|
|
194
|
+
import_log.log.trace("dxos.mesh.connection.open-connection", import_protocols.trace.end({
|
|
195
|
+
id: this._instanceId
|
|
196
|
+
}), {
|
|
197
|
+
file: "connection.ts",
|
|
198
|
+
line: 143,
|
|
199
|
+
scope: this,
|
|
200
|
+
callSite: (f, a) => f(...a)
|
|
201
|
+
});
|
|
201
202
|
}
|
|
202
203
|
async close() {
|
|
203
204
|
var _a;
|
|
@@ -209,7 +210,7 @@ var Connection = class {
|
|
|
209
210
|
peerId: this.ownId
|
|
210
211
|
}, {
|
|
211
212
|
file: "connection.ts",
|
|
212
|
-
line:
|
|
213
|
+
line: 153,
|
|
213
214
|
scope: this,
|
|
214
215
|
callSite: (f, a) => f(...a)
|
|
215
216
|
});
|
|
@@ -218,7 +219,7 @@ var Connection = class {
|
|
|
218
219
|
} catch (err) {
|
|
219
220
|
import_log.log.catch(err, {}, {
|
|
220
221
|
file: "connection.ts",
|
|
221
|
-
line:
|
|
222
|
+
line: 159,
|
|
222
223
|
scope: this,
|
|
223
224
|
callSite: (f, a) => f(...a)
|
|
224
225
|
});
|
|
@@ -228,7 +229,7 @@ var Connection = class {
|
|
|
228
229
|
} catch (err1) {
|
|
229
230
|
import_log.log.catch(err1, {}, {
|
|
230
231
|
file: "connection.ts",
|
|
231
|
-
line:
|
|
232
|
+
line: 166,
|
|
232
233
|
scope: this,
|
|
233
234
|
callSite: (f, a) => f(...a)
|
|
234
235
|
});
|
|
@@ -237,23 +238,11 @@ var Connection = class {
|
|
|
237
238
|
peerId: this.ownId
|
|
238
239
|
}, {
|
|
239
240
|
file: "connection.ts",
|
|
240
|
-
line:
|
|
241
|
+
line: 169,
|
|
241
242
|
scope: this,
|
|
242
243
|
callSite: (f, a) => f(...a)
|
|
243
244
|
});
|
|
244
245
|
this._changeState(ConnectionState.CLOSED);
|
|
245
|
-
import_log.log.trace("dxos.mesh.connection", import_protocols.trace.end({
|
|
246
|
-
id: this._instanceId,
|
|
247
|
-
status: "ok",
|
|
248
|
-
data: {
|
|
249
|
-
performance: this._performance
|
|
250
|
-
}
|
|
251
|
-
}), {
|
|
252
|
-
file: "connection.ts",
|
|
253
|
-
line: 174,
|
|
254
|
-
scope: this,
|
|
255
|
-
callSite: (f, a) => f(...a)
|
|
256
|
-
});
|
|
257
246
|
}
|
|
258
247
|
async signal(msg) {
|
|
259
248
|
var _a, _b;
|
|
@@ -261,7 +250,7 @@ var Connection = class {
|
|
|
261
250
|
if (!msg.sessionId.equals(this.sessionId)) {
|
|
262
251
|
(0, import_log.log)("dropping signal for incorrect session id", {}, {
|
|
263
252
|
file: "connection.ts",
|
|
264
|
-
line:
|
|
253
|
+
line: 176,
|
|
265
254
|
scope: this,
|
|
266
255
|
callSite: (f, a) => f(...a)
|
|
267
256
|
});
|
|
@@ -277,7 +266,7 @@ var Connection = class {
|
|
|
277
266
|
msg: msg.data
|
|
278
267
|
}, {
|
|
279
268
|
file: "connection.ts",
|
|
280
|
-
line:
|
|
269
|
+
line: 184,
|
|
281
270
|
scope: this,
|
|
282
271
|
callSite: (f, a) => f(...a)
|
|
283
272
|
});
|
|
@@ -291,7 +280,7 @@ var Connection = class {
|
|
|
291
280
|
msg: msg.data
|
|
292
281
|
}, {
|
|
293
282
|
file: "connection.ts",
|
|
294
|
-
line:
|
|
283
|
+
line: 190,
|
|
295
284
|
scope: this,
|
|
296
285
|
callSite: (f, a) => f(...a)
|
|
297
286
|
});
|
|
@@ -304,7 +293,7 @@ var Connection = class {
|
|
|
304
293
|
peerId: this.ownId
|
|
305
294
|
}, {
|
|
306
295
|
file: "connection.ts",
|
|
307
|
-
line:
|
|
296
|
+
line: 195,
|
|
308
297
|
scope: this,
|
|
309
298
|
callSite: (f, a) => f(...a)
|
|
310
299
|
});
|
|
@@ -537,7 +526,7 @@ var Peer = class {
|
|
|
537
526
|
peerId: this.localPeerId
|
|
538
527
|
}, {
|
|
539
528
|
file: "peer.ts",
|
|
540
|
-
line:
|
|
529
|
+
line: 105,
|
|
541
530
|
scope: this,
|
|
542
531
|
callSite: (f, a) => f(...a)
|
|
543
532
|
});
|
|
@@ -564,7 +553,7 @@ var Peer = class {
|
|
|
564
553
|
err
|
|
565
554
|
}, {
|
|
566
555
|
file: "peer.ts",
|
|
567
|
-
line:
|
|
556
|
+
line: 129,
|
|
568
557
|
scope: this,
|
|
569
558
|
callSite: (f, a) => f(...a)
|
|
570
559
|
});
|
|
@@ -593,7 +582,7 @@ var Peer = class {
|
|
|
593
582
|
sessionId
|
|
594
583
|
}, {
|
|
595
584
|
file: "peer.ts",
|
|
596
|
-
line:
|
|
585
|
+
line: 147,
|
|
597
586
|
scope: this,
|
|
598
587
|
callSite: (f, a) => f(...a)
|
|
599
588
|
});
|
|
@@ -616,14 +605,14 @@ var Peer = class {
|
|
|
616
605
|
remoteId: this.id
|
|
617
606
|
}, {
|
|
618
607
|
file: "peer.ts",
|
|
619
|
-
line:
|
|
608
|
+
line: 159,
|
|
620
609
|
scope: this,
|
|
621
610
|
callSite: (f, a) => f(...a)
|
|
622
611
|
});
|
|
623
612
|
if (connection.state !== ConnectionState.INITIAL) {
|
|
624
613
|
(0, import_log3.log)("ignoring response", {}, {
|
|
625
614
|
file: "peer.ts",
|
|
626
|
-
line:
|
|
615
|
+
line: 161,
|
|
627
616
|
scope: this,
|
|
628
617
|
callSite: (f, a) => f(...a)
|
|
629
618
|
});
|
|
@@ -643,7 +632,7 @@ var Peer = class {
|
|
|
643
632
|
err
|
|
644
633
|
}, {
|
|
645
634
|
file: "peer.ts",
|
|
646
|
-
line:
|
|
635
|
+
line: 172,
|
|
647
636
|
scope: this,
|
|
648
637
|
callSite: (f, a) => f(...a)
|
|
649
638
|
});
|
|
@@ -667,7 +656,7 @@ var Peer = class {
|
|
|
667
656
|
sessionId
|
|
668
657
|
}, {
|
|
669
658
|
file: "peer.ts",
|
|
670
|
-
line:
|
|
659
|
+
line: 186,
|
|
671
660
|
scope: this,
|
|
672
661
|
callSite: (f, a) => f(...a)
|
|
673
662
|
});
|
|
@@ -688,7 +677,6 @@ var Peer = class {
|
|
|
688
677
|
}),
|
|
689
678
|
this._transportFactory
|
|
690
679
|
);
|
|
691
|
-
connection._traceParent = this._traceParent;
|
|
692
680
|
this._callbacks.onInitiated(connection);
|
|
693
681
|
void ((_a = this._connectionCtx) == null ? void 0 : _a.dispose());
|
|
694
682
|
this._connectionCtx = this._ctx.derive();
|
|
@@ -708,7 +696,7 @@ var Peer = class {
|
|
|
708
696
|
initiator
|
|
709
697
|
}, {
|
|
710
698
|
file: "peer.ts",
|
|
711
|
-
line:
|
|
699
|
+
line: 221,
|
|
712
700
|
scope: this,
|
|
713
701
|
callSite: (f, a) => f(...a)
|
|
714
702
|
});
|
|
@@ -738,7 +726,7 @@ var Peer = class {
|
|
|
738
726
|
err
|
|
739
727
|
}, {
|
|
740
728
|
file: "peer.ts",
|
|
741
|
-
line:
|
|
729
|
+
line: 249,
|
|
742
730
|
scope: this,
|
|
743
731
|
callSite: (f, a) => f(...a)
|
|
744
732
|
});
|
|
@@ -757,7 +745,7 @@ var Peer = class {
|
|
|
757
745
|
sessionId: connection.sessionId
|
|
758
746
|
}, {
|
|
759
747
|
file: "peer.ts",
|
|
760
|
-
line:
|
|
748
|
+
line: 265,
|
|
761
749
|
scope: this,
|
|
762
750
|
callSite: (f, a) => f(...a)
|
|
763
751
|
});
|
|
@@ -767,7 +755,7 @@ var Peer = class {
|
|
|
767
755
|
sessionId: connection.sessionId
|
|
768
756
|
}, {
|
|
769
757
|
file: "peer.ts",
|
|
770
|
-
line:
|
|
758
|
+
line: 271,
|
|
771
759
|
scope: this,
|
|
772
760
|
callSite: (f, a) => f(...a)
|
|
773
761
|
});
|
|
@@ -778,7 +766,7 @@ var Peer = class {
|
|
|
778
766
|
message
|
|
779
767
|
}, {
|
|
780
768
|
file: "peer.ts",
|
|
781
|
-
line:
|
|
769
|
+
line: 276,
|
|
782
770
|
scope: this,
|
|
783
771
|
callSite: (f, a) => f(...a)
|
|
784
772
|
});
|
|
@@ -794,7 +782,7 @@ var Peer = class {
|
|
|
794
782
|
topic: this.topic
|
|
795
783
|
}, {
|
|
796
784
|
file: "peer.ts",
|
|
797
|
-
line:
|
|
785
|
+
line: 285,
|
|
798
786
|
scope: this,
|
|
799
787
|
callSite: (f, a) => f(...a)
|
|
800
788
|
});
|
|
@@ -848,11 +836,23 @@ var Swarm = class {
|
|
|
848
836
|
this.connected = new import_async3.Event();
|
|
849
837
|
this.errors = new import_debug2.ErrorStream();
|
|
850
838
|
this._instanceId = import_keys4.PublicKey.random().toHex();
|
|
839
|
+
import_log4.log.trace("dxos.mesh.swarm.constructor", import_protocols3.trace.begin({
|
|
840
|
+
id: this._instanceId,
|
|
841
|
+
data: {
|
|
842
|
+
topic: this._topic.toHex(),
|
|
843
|
+
peerId: this._ownPeerId.toHex()
|
|
844
|
+
}
|
|
845
|
+
}), {
|
|
846
|
+
file: "swarm.ts",
|
|
847
|
+
line: 84,
|
|
848
|
+
scope: this,
|
|
849
|
+
callSite: (f, a) => f(...a)
|
|
850
|
+
});
|
|
851
851
|
(0, import_log4.log)("creating swarm", {
|
|
852
852
|
peerId: _ownPeerId
|
|
853
853
|
}, {
|
|
854
854
|
file: "swarm.ts",
|
|
855
|
-
line:
|
|
855
|
+
line: 88,
|
|
856
856
|
scope: this,
|
|
857
857
|
callSite: (f, a) => f(...a)
|
|
858
858
|
});
|
|
@@ -869,19 +869,15 @@ var Swarm = class {
|
|
|
869
869
|
onMessage: async (message) => await this._swarmMessenger.receiveMessage(message)
|
|
870
870
|
}).catch((error) => import_log4.log.catch(error, {}, {
|
|
871
871
|
file: "swarm.ts",
|
|
872
|
-
line:
|
|
872
|
+
line: 104,
|
|
873
873
|
scope: this,
|
|
874
874
|
callSite: (f, a) => f(...a)
|
|
875
875
|
}));
|
|
876
|
-
import_log4.log.trace("dxos.mesh.swarm", import_protocols3.trace.
|
|
877
|
-
id: this._instanceId
|
|
878
|
-
data: {
|
|
879
|
-
topic: this._topic.toHex(),
|
|
880
|
-
peerId: this._ownPeerId.toHex()
|
|
881
|
-
}
|
|
876
|
+
import_log4.log.trace("dxos.mesh.swarm.constructor", import_protocols3.trace.end({
|
|
877
|
+
id: this._instanceId
|
|
882
878
|
}), {
|
|
883
879
|
file: "swarm.ts",
|
|
884
|
-
line:
|
|
880
|
+
line: 106,
|
|
885
881
|
scope: this,
|
|
886
882
|
callSite: (f, a) => f(...a)
|
|
887
883
|
});
|
|
@@ -905,7 +901,7 @@ var Swarm = class {
|
|
|
905
901
|
async destroy() {
|
|
906
902
|
(0, import_log4.log)("destroying...", {}, {
|
|
907
903
|
file: "swarm.ts",
|
|
908
|
-
line:
|
|
904
|
+
line: 134,
|
|
909
905
|
scope: this,
|
|
910
906
|
callSite: (f, a) => f(...a)
|
|
911
907
|
});
|
|
@@ -913,14 +909,6 @@ var Swarm = class {
|
|
|
913
909
|
await this._topology.destroy();
|
|
914
910
|
await Promise.all(Array.from(this._peers.keys()).map((key) => this._destroyPeer(key)));
|
|
915
911
|
(0, import_log4.log)("destroyed", {}, {
|
|
916
|
-
file: "swarm.ts",
|
|
917
|
-
line: 137,
|
|
918
|
-
scope: this,
|
|
919
|
-
callSite: (f, a) => f(...a)
|
|
920
|
-
});
|
|
921
|
-
import_log4.log.trace("dxos.mesh.swarm", import_protocols3.trace.end({
|
|
922
|
-
id: this._instanceId
|
|
923
|
-
}), {
|
|
924
912
|
file: "swarm.ts",
|
|
925
913
|
line: 138,
|
|
926
914
|
scope: this,
|
|
@@ -1116,7 +1104,6 @@ var Swarm = class {
|
|
|
1116
1104
|
this._topology.update();
|
|
1117
1105
|
}
|
|
1118
1106
|
});
|
|
1119
|
-
peer._traceParent = this._instanceId;
|
|
1120
1107
|
this._peers.set(peerId, peer);
|
|
1121
1108
|
}
|
|
1122
1109
|
return peer;
|
|
@@ -1143,7 +1130,7 @@ var Swarm = class {
|
|
|
1143
1130
|
} catch (err) {
|
|
1144
1131
|
import_log4.log.warn("initiation error", err, {
|
|
1145
1132
|
file: "swarm.ts",
|
|
1146
|
-
line:
|
|
1133
|
+
line: 319,
|
|
1147
1134
|
scope: this,
|
|
1148
1135
|
callSite: (f, a) => f(...a)
|
|
1149
1136
|
});
|
|
@@ -1171,7 +1158,7 @@ var Swarm = class {
|
|
|
1171
1158
|
remoteId
|
|
1172
1159
|
}, {
|
|
1173
1160
|
file: "swarm.ts",
|
|
1174
|
-
line:
|
|
1161
|
+
line: 346,
|
|
1175
1162
|
scope: this,
|
|
1176
1163
|
callSite: (f, a) => f(...a)
|
|
1177
1164
|
});
|
|
@@ -1188,7 +1175,7 @@ var Swarm = class {
|
|
|
1188
1175
|
remoteId
|
|
1189
1176
|
}, {
|
|
1190
1177
|
file: "swarm.ts",
|
|
1191
|
-
line:
|
|
1178
|
+
line: 360,
|
|
1192
1179
|
scope: this,
|
|
1193
1180
|
callSite: (f, a) => f(...a)
|
|
1194
1181
|
});
|
|
@@ -1198,7 +1185,7 @@ var Swarm = class {
|
|
|
1198
1185
|
remoteId
|
|
1199
1186
|
}, {
|
|
1200
1187
|
file: "swarm.ts",
|
|
1201
|
-
line:
|
|
1188
|
+
line: 363,
|
|
1202
1189
|
scope: this,
|
|
1203
1190
|
callSite: (f, a) => f(...a)
|
|
1204
1191
|
});
|
|
@@ -1384,7 +1371,6 @@ var NetworkManager = class {
|
|
|
1384
1371
|
this.connectionStateChanged = new import_async6.Event();
|
|
1385
1372
|
this.topicsUpdated = new import_async6.Event();
|
|
1386
1373
|
this._instanceId = import_keys7.PublicKey.random().toHex();
|
|
1387
|
-
signalManager._traceParent = this._instanceId;
|
|
1388
1374
|
this._transportFactory = transportFactory;
|
|
1389
1375
|
this._signalManager = signalManager;
|
|
1390
1376
|
this._signalManager.swarmEvent.on(({ topic, swarmEvent: event }) => {
|
|
@@ -1394,7 +1380,6 @@ var NetworkManager = class {
|
|
|
1394
1380
|
this._messenger = new import_messaging.Messenger({
|
|
1395
1381
|
signalManager: this._signalManager
|
|
1396
1382
|
});
|
|
1397
|
-
this._messenger._traceParent = this._instanceId;
|
|
1398
1383
|
this._signalConnection = {
|
|
1399
1384
|
join: (opts) => this._signalManager.join(opts),
|
|
1400
1385
|
leave: (opts) => this._signalManager.leave(opts)
|
|
@@ -1407,10 +1392,6 @@ var NetworkManager = class {
|
|
|
1407
1392
|
get connectionLog() {
|
|
1408
1393
|
return this._connectionLog;
|
|
1409
1394
|
}
|
|
1410
|
-
// TODO(burdon): Remove access (Devtools only).
|
|
1411
|
-
get signalManager() {
|
|
1412
|
-
return this._signalManager;
|
|
1413
|
-
}
|
|
1414
1395
|
get connectionState() {
|
|
1415
1396
|
return this._connectionState;
|
|
1416
1397
|
}
|
|
@@ -1425,24 +1406,31 @@ var NetworkManager = class {
|
|
|
1425
1406
|
return this._swarms.get(topic);
|
|
1426
1407
|
}
|
|
1427
1408
|
async open() {
|
|
1428
|
-
import_log6.log.trace("dxos.mesh.network-manager", import_protocols4.trace.begin({
|
|
1429
|
-
id: this._instanceId
|
|
1430
|
-
parentId: this._traceParent
|
|
1409
|
+
import_log6.log.trace("dxos.mesh.network-manager.open", import_protocols4.trace.begin({
|
|
1410
|
+
id: this._instanceId
|
|
1431
1411
|
}), {
|
|
1432
1412
|
file: "network-manager.ts",
|
|
1433
|
-
line:
|
|
1413
|
+
line: 127,
|
|
1434
1414
|
scope: this,
|
|
1435
1415
|
callSite: (f, a) => f(...a)
|
|
1436
1416
|
});
|
|
1437
1417
|
await this._messenger.open();
|
|
1438
1418
|
await this._signalManager.open();
|
|
1419
|
+
import_log6.log.trace("dxos.mesh.network-manager.open", import_protocols4.trace.end({
|
|
1420
|
+
id: this._instanceId
|
|
1421
|
+
}), {
|
|
1422
|
+
file: "network-manager.ts",
|
|
1423
|
+
line: 130,
|
|
1424
|
+
scope: this,
|
|
1425
|
+
callSite: (f, a) => f(...a)
|
|
1426
|
+
});
|
|
1439
1427
|
}
|
|
1440
1428
|
async close() {
|
|
1441
1429
|
for (const topic of this._swarms.keys()) {
|
|
1442
1430
|
await this.leaveSwarm(topic).catch((err) => {
|
|
1443
1431
|
(0, import_log6.log)(err, {}, {
|
|
1444
1432
|
file: "network-manager.ts",
|
|
1445
|
-
line:
|
|
1433
|
+
line: 136,
|
|
1446
1434
|
scope: this,
|
|
1447
1435
|
callSite: (f, a) => f(...a)
|
|
1448
1436
|
});
|
|
@@ -1450,14 +1438,6 @@ var NetworkManager = class {
|
|
|
1450
1438
|
}
|
|
1451
1439
|
await this._messenger.close();
|
|
1452
1440
|
await this._signalManager.close();
|
|
1453
|
-
import_log6.log.trace("dxos.mesh.network-manager", import_protocols4.trace.end({
|
|
1454
|
-
id: this._instanceId
|
|
1455
|
-
}), {
|
|
1456
|
-
file: "network-manager.ts",
|
|
1457
|
-
line: 149,
|
|
1458
|
-
scope: this,
|
|
1459
|
-
callSite: (f, a) => f(...a)
|
|
1460
|
-
});
|
|
1461
1441
|
}
|
|
1462
1442
|
/**
|
|
1463
1443
|
* Join the swarm.
|
|
@@ -1477,7 +1457,7 @@ var NetworkManager = class {
|
|
|
1477
1457
|
topology: topology.toString()
|
|
1478
1458
|
}, {
|
|
1479
1459
|
file: "network-manager.ts",
|
|
1480
|
-
line:
|
|
1460
|
+
line: 162,
|
|
1481
1461
|
scope: this,
|
|
1482
1462
|
callSite: (f, a) => f(...a)
|
|
1483
1463
|
});
|
|
@@ -1487,7 +1467,7 @@ var NetworkManager = class {
|
|
|
1487
1467
|
error
|
|
1488
1468
|
}, {
|
|
1489
1469
|
file: "network-manager.ts",
|
|
1490
|
-
line:
|
|
1470
|
+
line: 165,
|
|
1491
1471
|
scope: this,
|
|
1492
1472
|
callSite: (f, a) => f(...a)
|
|
1493
1473
|
});
|
|
@@ -1498,7 +1478,7 @@ var NetworkManager = class {
|
|
|
1498
1478
|
peerId
|
|
1499
1479
|
}).catch((error) => import_log6.log.catch(error, {}, {
|
|
1500
1480
|
file: "network-manager.ts",
|
|
1501
|
-
line:
|
|
1481
|
+
line: 169,
|
|
1502
1482
|
scope: this,
|
|
1503
1483
|
callSite: (f, a) => f(...a)
|
|
1504
1484
|
}));
|
|
@@ -1510,7 +1490,7 @@ var NetworkManager = class {
|
|
|
1510
1490
|
count: this._swarms.size
|
|
1511
1491
|
}, {
|
|
1512
1492
|
file: "network-manager.ts",
|
|
1513
|
-
line:
|
|
1493
|
+
line: 174,
|
|
1514
1494
|
scope: this,
|
|
1515
1495
|
callSite: (f, a) => f(...a)
|
|
1516
1496
|
});
|
|
@@ -1524,21 +1504,13 @@ var NetworkManager = class {
|
|
|
1524
1504
|
async leaveSwarm(topic) {
|
|
1525
1505
|
var _a;
|
|
1526
1506
|
if (!this._swarms.has(topic)) {
|
|
1527
|
-
import_log6.log.warn("swarm not open", {
|
|
1528
|
-
topic: import_keys7.PublicKey.from(topic).truncate()
|
|
1529
|
-
}, {
|
|
1530
|
-
file: "network-manager.ts",
|
|
1531
|
-
line: 194,
|
|
1532
|
-
scope: this,
|
|
1533
|
-
callSite: (f, a) => f(...a)
|
|
1534
|
-
});
|
|
1535
1507
|
return;
|
|
1536
1508
|
}
|
|
1537
1509
|
(0, import_log6.log)("leaving", {
|
|
1538
1510
|
topic: import_keys7.PublicKey.from(topic)
|
|
1539
1511
|
}, {
|
|
1540
1512
|
file: "network-manager.ts",
|
|
1541
|
-
line:
|
|
1513
|
+
line: 190,
|
|
1542
1514
|
scope: this,
|
|
1543
1515
|
callSite: (f, a) => f(...a)
|
|
1544
1516
|
});
|
|
@@ -1559,7 +1531,7 @@ var NetworkManager = class {
|
|
|
1559
1531
|
count: this._swarms.size
|
|
1560
1532
|
}, {
|
|
1561
1533
|
file: "network-manager.ts",
|
|
1562
|
-
line:
|
|
1534
|
+
line: 204,
|
|
1563
1535
|
scope: this,
|
|
1564
1536
|
callSite: (f, a) => f(...a)
|
|
1565
1537
|
});
|
|
@@ -1960,21 +1932,17 @@ var WebRTCTransport = class {
|
|
|
1960
1932
|
this.connected = new import_async8.Event();
|
|
1961
1933
|
this.errors = new import_debug5.ErrorStream();
|
|
1962
1934
|
this._instanceId = import_keys9.PublicKey.random().toHex();
|
|
1963
|
-
|
|
1964
|
-
bytesSent: 0,
|
|
1965
|
-
bytesReceived: 0
|
|
1966
|
-
};
|
|
1967
|
-
import_log10.log.trace("dxos.mesh.webrtc-transport", import_protocols5.trace.begin({
|
|
1935
|
+
import_log10.log.trace("dxos.mesh.webrtc-transport.constructor", import_protocols5.trace.begin({
|
|
1968
1936
|
id: this._instanceId
|
|
1969
1937
|
}), {
|
|
1970
1938
|
file: "webrtc-transport.ts",
|
|
1971
|
-
line:
|
|
1939
|
+
line: 39,
|
|
1972
1940
|
scope: this,
|
|
1973
1941
|
callSite: (f, a) => f(...a)
|
|
1974
1942
|
});
|
|
1975
1943
|
(0, import_log10.log)("created connection", params, {
|
|
1976
1944
|
file: "webrtc-transport.ts",
|
|
1977
|
-
line:
|
|
1945
|
+
line: 40,
|
|
1978
1946
|
scope: this,
|
|
1979
1947
|
callSite: (f, a) => f(...a)
|
|
1980
1948
|
});
|
|
@@ -1986,7 +1954,7 @@ var WebRTCTransport = class {
|
|
|
1986
1954
|
this._peer.on("signal", async (data) => {
|
|
1987
1955
|
(0, import_log10.log)("signal", data, {
|
|
1988
1956
|
file: "webrtc-transport.ts",
|
|
1989
|
-
line:
|
|
1957
|
+
line: 48,
|
|
1990
1958
|
scope: this,
|
|
1991
1959
|
callSite: (f, a) => f(...a)
|
|
1992
1960
|
});
|
|
@@ -1999,7 +1967,7 @@ var WebRTCTransport = class {
|
|
|
1999
1967
|
this._peer.on("connect", () => {
|
|
2000
1968
|
(0, import_log10.log)("connected", {}, {
|
|
2001
1969
|
file: "webrtc-transport.ts",
|
|
2002
|
-
line:
|
|
1970
|
+
line: 53,
|
|
2003
1971
|
scope: this,
|
|
2004
1972
|
callSite: (f, a) => f(...a)
|
|
2005
1973
|
});
|
|
@@ -2009,7 +1977,7 @@ var WebRTCTransport = class {
|
|
|
2009
1977
|
this._peer.on("close", async () => {
|
|
2010
1978
|
(0, import_log10.log)("closed", {}, {
|
|
2011
1979
|
file: "webrtc-transport.ts",
|
|
2012
|
-
line:
|
|
1980
|
+
line: 59,
|
|
2013
1981
|
scope: this,
|
|
2014
1982
|
callSite: (f, a) => f(...a)
|
|
2015
1983
|
});
|
|
@@ -2027,7 +1995,7 @@ var WebRTCTransport = class {
|
|
|
2027
1995
|
stats
|
|
2028
1996
|
}, {
|
|
2029
1997
|
file: "webrtc-transport.ts",
|
|
2030
|
-
line:
|
|
1998
|
+
line: 71,
|
|
2031
1999
|
scope: this,
|
|
2032
2000
|
callSite: (f, a) => f(...a)
|
|
2033
2001
|
});
|
|
@@ -2037,11 +2005,19 @@ var WebRTCTransport = class {
|
|
|
2037
2005
|
}
|
|
2038
2006
|
await this.destroy();
|
|
2039
2007
|
});
|
|
2008
|
+
import_log10.log.trace("dxos.mesh.webrtc-transport.constructor", import_protocols5.trace.end({
|
|
2009
|
+
id: this._instanceId
|
|
2010
|
+
}), {
|
|
2011
|
+
file: "webrtc-transport.ts",
|
|
2012
|
+
line: 81,
|
|
2013
|
+
scope: this,
|
|
2014
|
+
callSite: (f, a) => f(...a)
|
|
2015
|
+
});
|
|
2040
2016
|
}
|
|
2041
2017
|
async destroy() {
|
|
2042
2018
|
(0, import_log10.log)("closing...", {}, {
|
|
2043
2019
|
file: "webrtc-transport.ts",
|
|
2044
|
-
line:
|
|
2020
|
+
line: 85,
|
|
2045
2021
|
scope: this,
|
|
2046
2022
|
callSite: (f, a) => f(...a)
|
|
2047
2023
|
});
|
|
@@ -2051,18 +2027,7 @@ var WebRTCTransport = class {
|
|
|
2051
2027
|
this.closed.emit();
|
|
2052
2028
|
(0, import_log10.log)("closed", {}, {
|
|
2053
2029
|
file: "webrtc-transport.ts",
|
|
2054
|
-
line:
|
|
2055
|
-
scope: this,
|
|
2056
|
-
callSite: (f, a) => f(...a)
|
|
2057
|
-
});
|
|
2058
|
-
import_log10.log.trace("dxos.mesh.webrtc-transport", import_protocols5.trace.end({
|
|
2059
|
-
id: this._instanceId,
|
|
2060
|
-
data: {
|
|
2061
|
-
performance: this._performance
|
|
2062
|
-
}
|
|
2063
|
-
}), {
|
|
2064
|
-
file: "webrtc-transport.ts",
|
|
2065
|
-
line: 94,
|
|
2030
|
+
line: 90,
|
|
2066
2031
|
scope: this,
|
|
2067
2032
|
callSite: (f, a) => f(...a)
|
|
2068
2033
|
});
|