@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
|
@@ -73,9 +73,6 @@ var Connection = class {
|
|
|
73
73
|
this.stateChanged = new Event();
|
|
74
74
|
this.errors = new ErrorStream();
|
|
75
75
|
this._instanceId = PublicKey.random().toHex();
|
|
76
|
-
this._performance = {
|
|
77
|
-
signalsSent: 0
|
|
78
|
-
};
|
|
79
76
|
}
|
|
80
77
|
get state() {
|
|
81
78
|
return this._state;
|
|
@@ -92,23 +89,22 @@ var Connection = class {
|
|
|
92
89
|
// TODO(burdon): Make async?
|
|
93
90
|
openConnection() {
|
|
94
91
|
assert(this._state === ConnectionState.INITIAL, "Invalid state.");
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
id: this._instanceId,
|
|
98
|
-
parentId: this._traceParent
|
|
92
|
+
log.trace("dxos.mesh.connection.open-connection", trace.begin({
|
|
93
|
+
id: this._instanceId
|
|
99
94
|
}), {
|
|
100
95
|
file: "connection.ts",
|
|
101
|
-
line:
|
|
96
|
+
line: 92,
|
|
102
97
|
scope: this,
|
|
103
98
|
callSite: (f, a) => f(...a)
|
|
104
99
|
});
|
|
100
|
+
this._changeState(ConnectionState.CONNECTING);
|
|
105
101
|
this._protocol.initialize().catch((err) => {
|
|
106
102
|
this.errors.raise(err);
|
|
107
103
|
});
|
|
108
104
|
this._protocol.stream.on("close", () => {
|
|
109
105
|
log("protocol stream closed", {}, {
|
|
110
106
|
file: "connection.ts",
|
|
111
|
-
line:
|
|
107
|
+
line: 103,
|
|
112
108
|
scope: this,
|
|
113
109
|
callSite: (f, a) => f(...a)
|
|
114
110
|
});
|
|
@@ -118,18 +114,15 @@ var Connection = class {
|
|
|
118
114
|
this._transport = this._transportFactory.createTransport({
|
|
119
115
|
initiator: this.initiator,
|
|
120
116
|
stream: this._protocol.stream,
|
|
121
|
-
sendSignal: async (signal) => {
|
|
122
|
-
this.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
117
|
+
sendSignal: async (signal) => this._signalMessaging.signal({
|
|
118
|
+
author: this.ownId,
|
|
119
|
+
recipient: this.remoteId,
|
|
120
|
+
sessionId: this.sessionId,
|
|
121
|
+
topic: this.topic,
|
|
122
|
+
data: {
|
|
123
|
+
signal
|
|
124
|
+
}
|
|
125
|
+
})
|
|
133
126
|
});
|
|
134
127
|
this._transport.connected.once(() => {
|
|
135
128
|
this._changeState(ConnectionState.CONNECTED);
|
|
@@ -147,6 +140,14 @@ var Connection = class {
|
|
|
147
140
|
void this._transport.signal(signal);
|
|
148
141
|
}
|
|
149
142
|
this._bufferedSignals = [];
|
|
143
|
+
log.trace("dxos.mesh.connection.open-connection", trace.end({
|
|
144
|
+
id: this._instanceId
|
|
145
|
+
}), {
|
|
146
|
+
file: "connection.ts",
|
|
147
|
+
line: 143,
|
|
148
|
+
scope: this,
|
|
149
|
+
callSite: (f, a) => f(...a)
|
|
150
|
+
});
|
|
150
151
|
}
|
|
151
152
|
async close() {
|
|
152
153
|
var _a;
|
|
@@ -158,7 +159,7 @@ var Connection = class {
|
|
|
158
159
|
peerId: this.ownId
|
|
159
160
|
}, {
|
|
160
161
|
file: "connection.ts",
|
|
161
|
-
line:
|
|
162
|
+
line: 153,
|
|
162
163
|
scope: this,
|
|
163
164
|
callSite: (f, a) => f(...a)
|
|
164
165
|
});
|
|
@@ -167,7 +168,7 @@ var Connection = class {
|
|
|
167
168
|
} catch (err) {
|
|
168
169
|
log.catch(err, {}, {
|
|
169
170
|
file: "connection.ts",
|
|
170
|
-
line:
|
|
171
|
+
line: 159,
|
|
171
172
|
scope: this,
|
|
172
173
|
callSite: (f, a) => f(...a)
|
|
173
174
|
});
|
|
@@ -177,7 +178,7 @@ var Connection = class {
|
|
|
177
178
|
} catch (err1) {
|
|
178
179
|
log.catch(err1, {}, {
|
|
179
180
|
file: "connection.ts",
|
|
180
|
-
line:
|
|
181
|
+
line: 166,
|
|
181
182
|
scope: this,
|
|
182
183
|
callSite: (f, a) => f(...a)
|
|
183
184
|
});
|
|
@@ -186,23 +187,11 @@ var Connection = class {
|
|
|
186
187
|
peerId: this.ownId
|
|
187
188
|
}, {
|
|
188
189
|
file: "connection.ts",
|
|
189
|
-
line:
|
|
190
|
+
line: 169,
|
|
190
191
|
scope: this,
|
|
191
192
|
callSite: (f, a) => f(...a)
|
|
192
193
|
});
|
|
193
194
|
this._changeState(ConnectionState.CLOSED);
|
|
194
|
-
log.trace("dxos.mesh.connection", trace.end({
|
|
195
|
-
id: this._instanceId,
|
|
196
|
-
status: "ok",
|
|
197
|
-
data: {
|
|
198
|
-
performance: this._performance
|
|
199
|
-
}
|
|
200
|
-
}), {
|
|
201
|
-
file: "connection.ts",
|
|
202
|
-
line: 174,
|
|
203
|
-
scope: this,
|
|
204
|
-
callSite: (f, a) => f(...a)
|
|
205
|
-
});
|
|
206
195
|
}
|
|
207
196
|
async signal(msg) {
|
|
208
197
|
var _a, _b;
|
|
@@ -210,7 +199,7 @@ var Connection = class {
|
|
|
210
199
|
if (!msg.sessionId.equals(this.sessionId)) {
|
|
211
200
|
log("dropping signal for incorrect session id", {}, {
|
|
212
201
|
file: "connection.ts",
|
|
213
|
-
line:
|
|
202
|
+
line: 176,
|
|
214
203
|
scope: this,
|
|
215
204
|
callSite: (f, a) => f(...a)
|
|
216
205
|
});
|
|
@@ -226,7 +215,7 @@ var Connection = class {
|
|
|
226
215
|
msg: msg.data
|
|
227
216
|
}, {
|
|
228
217
|
file: "connection.ts",
|
|
229
|
-
line:
|
|
218
|
+
line: 184,
|
|
230
219
|
scope: this,
|
|
231
220
|
callSite: (f, a) => f(...a)
|
|
232
221
|
});
|
|
@@ -240,7 +229,7 @@ var Connection = class {
|
|
|
240
229
|
msg: msg.data
|
|
241
230
|
}, {
|
|
242
231
|
file: "connection.ts",
|
|
243
|
-
line:
|
|
232
|
+
line: 190,
|
|
244
233
|
scope: this,
|
|
245
234
|
callSite: (f, a) => f(...a)
|
|
246
235
|
});
|
|
@@ -253,7 +242,7 @@ var Connection = class {
|
|
|
253
242
|
peerId: this.ownId
|
|
254
243
|
}, {
|
|
255
244
|
file: "connection.ts",
|
|
256
|
-
line:
|
|
245
|
+
line: 195,
|
|
257
246
|
scope: this,
|
|
258
247
|
callSite: (f, a) => f(...a)
|
|
259
248
|
});
|
|
@@ -486,7 +475,7 @@ var Peer = class {
|
|
|
486
475
|
peerId: this.localPeerId
|
|
487
476
|
}, {
|
|
488
477
|
file: "peer.ts",
|
|
489
|
-
line:
|
|
478
|
+
line: 105,
|
|
490
479
|
scope: this,
|
|
491
480
|
callSite: (f, a) => f(...a)
|
|
492
481
|
});
|
|
@@ -513,7 +502,7 @@ var Peer = class {
|
|
|
513
502
|
err
|
|
514
503
|
}, {
|
|
515
504
|
file: "peer.ts",
|
|
516
|
-
line:
|
|
505
|
+
line: 129,
|
|
517
506
|
scope: this,
|
|
518
507
|
callSite: (f, a) => f(...a)
|
|
519
508
|
});
|
|
@@ -542,7 +531,7 @@ var Peer = class {
|
|
|
542
531
|
sessionId
|
|
543
532
|
}, {
|
|
544
533
|
file: "peer.ts",
|
|
545
|
-
line:
|
|
534
|
+
line: 147,
|
|
546
535
|
scope: this,
|
|
547
536
|
callSite: (f, a) => f(...a)
|
|
548
537
|
});
|
|
@@ -565,14 +554,14 @@ var Peer = class {
|
|
|
565
554
|
remoteId: this.id
|
|
566
555
|
}, {
|
|
567
556
|
file: "peer.ts",
|
|
568
|
-
line:
|
|
557
|
+
line: 159,
|
|
569
558
|
scope: this,
|
|
570
559
|
callSite: (f, a) => f(...a)
|
|
571
560
|
});
|
|
572
561
|
if (connection.state !== ConnectionState.INITIAL) {
|
|
573
562
|
log3("ignoring response", {}, {
|
|
574
563
|
file: "peer.ts",
|
|
575
|
-
line:
|
|
564
|
+
line: 161,
|
|
576
565
|
scope: this,
|
|
577
566
|
callSite: (f, a) => f(...a)
|
|
578
567
|
});
|
|
@@ -592,7 +581,7 @@ var Peer = class {
|
|
|
592
581
|
err
|
|
593
582
|
}, {
|
|
594
583
|
file: "peer.ts",
|
|
595
|
-
line:
|
|
584
|
+
line: 172,
|
|
596
585
|
scope: this,
|
|
597
586
|
callSite: (f, a) => f(...a)
|
|
598
587
|
});
|
|
@@ -616,7 +605,7 @@ var Peer = class {
|
|
|
616
605
|
sessionId
|
|
617
606
|
}, {
|
|
618
607
|
file: "peer.ts",
|
|
619
|
-
line:
|
|
608
|
+
line: 186,
|
|
620
609
|
scope: this,
|
|
621
610
|
callSite: (f, a) => f(...a)
|
|
622
611
|
});
|
|
@@ -637,7 +626,6 @@ var Peer = class {
|
|
|
637
626
|
}),
|
|
638
627
|
this._transportFactory
|
|
639
628
|
);
|
|
640
|
-
connection._traceParent = this._traceParent;
|
|
641
629
|
this._callbacks.onInitiated(connection);
|
|
642
630
|
void ((_a = this._connectionCtx) == null ? void 0 : _a.dispose());
|
|
643
631
|
this._connectionCtx = this._ctx.derive();
|
|
@@ -657,7 +645,7 @@ var Peer = class {
|
|
|
657
645
|
initiator
|
|
658
646
|
}, {
|
|
659
647
|
file: "peer.ts",
|
|
660
|
-
line:
|
|
648
|
+
line: 221,
|
|
661
649
|
scope: this,
|
|
662
650
|
callSite: (f, a) => f(...a)
|
|
663
651
|
});
|
|
@@ -687,7 +675,7 @@ var Peer = class {
|
|
|
687
675
|
err
|
|
688
676
|
}, {
|
|
689
677
|
file: "peer.ts",
|
|
690
|
-
line:
|
|
678
|
+
line: 249,
|
|
691
679
|
scope: this,
|
|
692
680
|
callSite: (f, a) => f(...a)
|
|
693
681
|
});
|
|
@@ -706,7 +694,7 @@ var Peer = class {
|
|
|
706
694
|
sessionId: connection.sessionId
|
|
707
695
|
}, {
|
|
708
696
|
file: "peer.ts",
|
|
709
|
-
line:
|
|
697
|
+
line: 265,
|
|
710
698
|
scope: this,
|
|
711
699
|
callSite: (f, a) => f(...a)
|
|
712
700
|
});
|
|
@@ -716,7 +704,7 @@ var Peer = class {
|
|
|
716
704
|
sessionId: connection.sessionId
|
|
717
705
|
}, {
|
|
718
706
|
file: "peer.ts",
|
|
719
|
-
line:
|
|
707
|
+
line: 271,
|
|
720
708
|
scope: this,
|
|
721
709
|
callSite: (f, a) => f(...a)
|
|
722
710
|
});
|
|
@@ -727,7 +715,7 @@ var Peer = class {
|
|
|
727
715
|
message
|
|
728
716
|
}, {
|
|
729
717
|
file: "peer.ts",
|
|
730
|
-
line:
|
|
718
|
+
line: 276,
|
|
731
719
|
scope: this,
|
|
732
720
|
callSite: (f, a) => f(...a)
|
|
733
721
|
});
|
|
@@ -743,7 +731,7 @@ var Peer = class {
|
|
|
743
731
|
topic: this.topic
|
|
744
732
|
}, {
|
|
745
733
|
file: "peer.ts",
|
|
746
|
-
line:
|
|
734
|
+
line: 285,
|
|
747
735
|
scope: this,
|
|
748
736
|
callSite: (f, a) => f(...a)
|
|
749
737
|
});
|
|
@@ -797,11 +785,23 @@ var Swarm = class {
|
|
|
797
785
|
this.connected = new Event2();
|
|
798
786
|
this.errors = new ErrorStream2();
|
|
799
787
|
this._instanceId = PublicKey4.random().toHex();
|
|
788
|
+
log4.trace("dxos.mesh.swarm.constructor", trace2.begin({
|
|
789
|
+
id: this._instanceId,
|
|
790
|
+
data: {
|
|
791
|
+
topic: this._topic.toHex(),
|
|
792
|
+
peerId: this._ownPeerId.toHex()
|
|
793
|
+
}
|
|
794
|
+
}), {
|
|
795
|
+
file: "swarm.ts",
|
|
796
|
+
line: 84,
|
|
797
|
+
scope: this,
|
|
798
|
+
callSite: (f, a) => f(...a)
|
|
799
|
+
});
|
|
800
800
|
log4("creating swarm", {
|
|
801
801
|
peerId: _ownPeerId
|
|
802
802
|
}, {
|
|
803
803
|
file: "swarm.ts",
|
|
804
|
-
line:
|
|
804
|
+
line: 88,
|
|
805
805
|
scope: this,
|
|
806
806
|
callSite: (f, a) => f(...a)
|
|
807
807
|
});
|
|
@@ -818,19 +818,15 @@ var Swarm = class {
|
|
|
818
818
|
onMessage: async (message) => await this._swarmMessenger.receiveMessage(message)
|
|
819
819
|
}).catch((error) => log4.catch(error, {}, {
|
|
820
820
|
file: "swarm.ts",
|
|
821
|
-
line:
|
|
821
|
+
line: 104,
|
|
822
822
|
scope: this,
|
|
823
823
|
callSite: (f, a) => f(...a)
|
|
824
824
|
}));
|
|
825
|
-
log4.trace("dxos.mesh.swarm", trace2.
|
|
826
|
-
id: this._instanceId
|
|
827
|
-
data: {
|
|
828
|
-
topic: this._topic.toHex(),
|
|
829
|
-
peerId: this._ownPeerId.toHex()
|
|
830
|
-
}
|
|
825
|
+
log4.trace("dxos.mesh.swarm.constructor", trace2.end({
|
|
826
|
+
id: this._instanceId
|
|
831
827
|
}), {
|
|
832
828
|
file: "swarm.ts",
|
|
833
|
-
line:
|
|
829
|
+
line: 106,
|
|
834
830
|
scope: this,
|
|
835
831
|
callSite: (f, a) => f(...a)
|
|
836
832
|
});
|
|
@@ -854,7 +850,7 @@ var Swarm = class {
|
|
|
854
850
|
async destroy() {
|
|
855
851
|
log4("destroying...", {}, {
|
|
856
852
|
file: "swarm.ts",
|
|
857
|
-
line:
|
|
853
|
+
line: 134,
|
|
858
854
|
scope: this,
|
|
859
855
|
callSite: (f, a) => f(...a)
|
|
860
856
|
});
|
|
@@ -862,14 +858,6 @@ var Swarm = class {
|
|
|
862
858
|
await this._topology.destroy();
|
|
863
859
|
await Promise.all(Array.from(this._peers.keys()).map((key) => this._destroyPeer(key)));
|
|
864
860
|
log4("destroyed", {}, {
|
|
865
|
-
file: "swarm.ts",
|
|
866
|
-
line: 137,
|
|
867
|
-
scope: this,
|
|
868
|
-
callSite: (f, a) => f(...a)
|
|
869
|
-
});
|
|
870
|
-
log4.trace("dxos.mesh.swarm", trace2.end({
|
|
871
|
-
id: this._instanceId
|
|
872
|
-
}), {
|
|
873
861
|
file: "swarm.ts",
|
|
874
862
|
line: 138,
|
|
875
863
|
scope: this,
|
|
@@ -1065,7 +1053,6 @@ var Swarm = class {
|
|
|
1065
1053
|
this._topology.update();
|
|
1066
1054
|
}
|
|
1067
1055
|
});
|
|
1068
|
-
peer._traceParent = this._instanceId;
|
|
1069
1056
|
this._peers.set(peerId, peer);
|
|
1070
1057
|
}
|
|
1071
1058
|
return peer;
|
|
@@ -1092,7 +1079,7 @@ var Swarm = class {
|
|
|
1092
1079
|
} catch (err) {
|
|
1093
1080
|
log4.warn("initiation error", err, {
|
|
1094
1081
|
file: "swarm.ts",
|
|
1095
|
-
line:
|
|
1082
|
+
line: 319,
|
|
1096
1083
|
scope: this,
|
|
1097
1084
|
callSite: (f, a) => f(...a)
|
|
1098
1085
|
});
|
|
@@ -1120,7 +1107,7 @@ var Swarm = class {
|
|
|
1120
1107
|
remoteId
|
|
1121
1108
|
}, {
|
|
1122
1109
|
file: "swarm.ts",
|
|
1123
|
-
line:
|
|
1110
|
+
line: 346,
|
|
1124
1111
|
scope: this,
|
|
1125
1112
|
callSite: (f, a) => f(...a)
|
|
1126
1113
|
});
|
|
@@ -1137,7 +1124,7 @@ var Swarm = class {
|
|
|
1137
1124
|
remoteId
|
|
1138
1125
|
}, {
|
|
1139
1126
|
file: "swarm.ts",
|
|
1140
|
-
line:
|
|
1127
|
+
line: 360,
|
|
1141
1128
|
scope: this,
|
|
1142
1129
|
callSite: (f, a) => f(...a)
|
|
1143
1130
|
});
|
|
@@ -1147,7 +1134,7 @@ var Swarm = class {
|
|
|
1147
1134
|
remoteId
|
|
1148
1135
|
}, {
|
|
1149
1136
|
file: "swarm.ts",
|
|
1150
|
-
line:
|
|
1137
|
+
line: 363,
|
|
1151
1138
|
scope: this,
|
|
1152
1139
|
callSite: (f, a) => f(...a)
|
|
1153
1140
|
});
|
|
@@ -1337,7 +1324,6 @@ var NetworkManager = class {
|
|
|
1337
1324
|
this.connectionStateChanged = new Event5();
|
|
1338
1325
|
this.topicsUpdated = new Event5();
|
|
1339
1326
|
this._instanceId = PublicKey7.random().toHex();
|
|
1340
|
-
signalManager._traceParent = this._instanceId;
|
|
1341
1327
|
this._transportFactory = transportFactory;
|
|
1342
1328
|
this._signalManager = signalManager;
|
|
1343
1329
|
this._signalManager.swarmEvent.on(({ topic, swarmEvent: event }) => {
|
|
@@ -1347,7 +1333,6 @@ var NetworkManager = class {
|
|
|
1347
1333
|
this._messenger = new Messenger({
|
|
1348
1334
|
signalManager: this._signalManager
|
|
1349
1335
|
});
|
|
1350
|
-
this._messenger._traceParent = this._instanceId;
|
|
1351
1336
|
this._signalConnection = {
|
|
1352
1337
|
join: (opts) => this._signalManager.join(opts),
|
|
1353
1338
|
leave: (opts) => this._signalManager.leave(opts)
|
|
@@ -1360,10 +1345,6 @@ var NetworkManager = class {
|
|
|
1360
1345
|
get connectionLog() {
|
|
1361
1346
|
return this._connectionLog;
|
|
1362
1347
|
}
|
|
1363
|
-
// TODO(burdon): Remove access (Devtools only).
|
|
1364
|
-
get signalManager() {
|
|
1365
|
-
return this._signalManager;
|
|
1366
|
-
}
|
|
1367
1348
|
get connectionState() {
|
|
1368
1349
|
return this._connectionState;
|
|
1369
1350
|
}
|
|
@@ -1378,24 +1359,31 @@ var NetworkManager = class {
|
|
|
1378
1359
|
return this._swarms.get(topic);
|
|
1379
1360
|
}
|
|
1380
1361
|
async open() {
|
|
1381
|
-
log6.trace("dxos.mesh.network-manager", trace3.begin({
|
|
1382
|
-
id: this._instanceId
|
|
1383
|
-
parentId: this._traceParent
|
|
1362
|
+
log6.trace("dxos.mesh.network-manager.open", trace3.begin({
|
|
1363
|
+
id: this._instanceId
|
|
1384
1364
|
}), {
|
|
1385
1365
|
file: "network-manager.ts",
|
|
1386
|
-
line:
|
|
1366
|
+
line: 127,
|
|
1387
1367
|
scope: this,
|
|
1388
1368
|
callSite: (f, a) => f(...a)
|
|
1389
1369
|
});
|
|
1390
1370
|
await this._messenger.open();
|
|
1391
1371
|
await this._signalManager.open();
|
|
1372
|
+
log6.trace("dxos.mesh.network-manager.open", trace3.end({
|
|
1373
|
+
id: this._instanceId
|
|
1374
|
+
}), {
|
|
1375
|
+
file: "network-manager.ts",
|
|
1376
|
+
line: 130,
|
|
1377
|
+
scope: this,
|
|
1378
|
+
callSite: (f, a) => f(...a)
|
|
1379
|
+
});
|
|
1392
1380
|
}
|
|
1393
1381
|
async close() {
|
|
1394
1382
|
for (const topic of this._swarms.keys()) {
|
|
1395
1383
|
await this.leaveSwarm(topic).catch((err) => {
|
|
1396
1384
|
log6(err, {}, {
|
|
1397
1385
|
file: "network-manager.ts",
|
|
1398
|
-
line:
|
|
1386
|
+
line: 136,
|
|
1399
1387
|
scope: this,
|
|
1400
1388
|
callSite: (f, a) => f(...a)
|
|
1401
1389
|
});
|
|
@@ -1403,14 +1391,6 @@ var NetworkManager = class {
|
|
|
1403
1391
|
}
|
|
1404
1392
|
await this._messenger.close();
|
|
1405
1393
|
await this._signalManager.close();
|
|
1406
|
-
log6.trace("dxos.mesh.network-manager", trace3.end({
|
|
1407
|
-
id: this._instanceId
|
|
1408
|
-
}), {
|
|
1409
|
-
file: "network-manager.ts",
|
|
1410
|
-
line: 149,
|
|
1411
|
-
scope: this,
|
|
1412
|
-
callSite: (f, a) => f(...a)
|
|
1413
|
-
});
|
|
1414
1394
|
}
|
|
1415
1395
|
/**
|
|
1416
1396
|
* Join the swarm.
|
|
@@ -1430,7 +1410,7 @@ var NetworkManager = class {
|
|
|
1430
1410
|
topology: topology.toString()
|
|
1431
1411
|
}, {
|
|
1432
1412
|
file: "network-manager.ts",
|
|
1433
|
-
line:
|
|
1413
|
+
line: 162,
|
|
1434
1414
|
scope: this,
|
|
1435
1415
|
callSite: (f, a) => f(...a)
|
|
1436
1416
|
});
|
|
@@ -1440,7 +1420,7 @@ var NetworkManager = class {
|
|
|
1440
1420
|
error
|
|
1441
1421
|
}, {
|
|
1442
1422
|
file: "network-manager.ts",
|
|
1443
|
-
line:
|
|
1423
|
+
line: 165,
|
|
1444
1424
|
scope: this,
|
|
1445
1425
|
callSite: (f, a) => f(...a)
|
|
1446
1426
|
});
|
|
@@ -1451,7 +1431,7 @@ var NetworkManager = class {
|
|
|
1451
1431
|
peerId
|
|
1452
1432
|
}).catch((error) => log6.catch(error, {}, {
|
|
1453
1433
|
file: "network-manager.ts",
|
|
1454
|
-
line:
|
|
1434
|
+
line: 169,
|
|
1455
1435
|
scope: this,
|
|
1456
1436
|
callSite: (f, a) => f(...a)
|
|
1457
1437
|
}));
|
|
@@ -1463,7 +1443,7 @@ var NetworkManager = class {
|
|
|
1463
1443
|
count: this._swarms.size
|
|
1464
1444
|
}, {
|
|
1465
1445
|
file: "network-manager.ts",
|
|
1466
|
-
line:
|
|
1446
|
+
line: 174,
|
|
1467
1447
|
scope: this,
|
|
1468
1448
|
callSite: (f, a) => f(...a)
|
|
1469
1449
|
});
|
|
@@ -1477,21 +1457,13 @@ var NetworkManager = class {
|
|
|
1477
1457
|
async leaveSwarm(topic) {
|
|
1478
1458
|
var _a;
|
|
1479
1459
|
if (!this._swarms.has(topic)) {
|
|
1480
|
-
log6.warn("swarm not open", {
|
|
1481
|
-
topic: PublicKey7.from(topic).truncate()
|
|
1482
|
-
}, {
|
|
1483
|
-
file: "network-manager.ts",
|
|
1484
|
-
line: 194,
|
|
1485
|
-
scope: this,
|
|
1486
|
-
callSite: (f, a) => f(...a)
|
|
1487
|
-
});
|
|
1488
1460
|
return;
|
|
1489
1461
|
}
|
|
1490
1462
|
log6("leaving", {
|
|
1491
1463
|
topic: PublicKey7.from(topic)
|
|
1492
1464
|
}, {
|
|
1493
1465
|
file: "network-manager.ts",
|
|
1494
|
-
line:
|
|
1466
|
+
line: 190,
|
|
1495
1467
|
scope: this,
|
|
1496
1468
|
callSite: (f, a) => f(...a)
|
|
1497
1469
|
});
|
|
@@ -1512,7 +1484,7 @@ var NetworkManager = class {
|
|
|
1512
1484
|
count: this._swarms.size
|
|
1513
1485
|
}, {
|
|
1514
1486
|
file: "network-manager.ts",
|
|
1515
|
-
line:
|
|
1487
|
+
line: 204,
|
|
1516
1488
|
scope: this,
|
|
1517
1489
|
callSite: (f, a) => f(...a)
|
|
1518
1490
|
});
|
|
@@ -1913,21 +1885,17 @@ var WebRTCTransport = class {
|
|
|
1913
1885
|
this.connected = new Event7();
|
|
1914
1886
|
this.errors = new ErrorStream4();
|
|
1915
1887
|
this._instanceId = PublicKey9.random().toHex();
|
|
1916
|
-
|
|
1917
|
-
bytesSent: 0,
|
|
1918
|
-
bytesReceived: 0
|
|
1919
|
-
};
|
|
1920
|
-
log10.trace("dxos.mesh.webrtc-transport", trace4.begin({
|
|
1888
|
+
log10.trace("dxos.mesh.webrtc-transport.constructor", trace4.begin({
|
|
1921
1889
|
id: this._instanceId
|
|
1922
1890
|
}), {
|
|
1923
1891
|
file: "webrtc-transport.ts",
|
|
1924
|
-
line:
|
|
1892
|
+
line: 39,
|
|
1925
1893
|
scope: this,
|
|
1926
1894
|
callSite: (f, a) => f(...a)
|
|
1927
1895
|
});
|
|
1928
1896
|
log10("created connection", params, {
|
|
1929
1897
|
file: "webrtc-transport.ts",
|
|
1930
|
-
line:
|
|
1898
|
+
line: 40,
|
|
1931
1899
|
scope: this,
|
|
1932
1900
|
callSite: (f, a) => f(...a)
|
|
1933
1901
|
});
|
|
@@ -1939,7 +1907,7 @@ var WebRTCTransport = class {
|
|
|
1939
1907
|
this._peer.on("signal", async (data) => {
|
|
1940
1908
|
log10("signal", data, {
|
|
1941
1909
|
file: "webrtc-transport.ts",
|
|
1942
|
-
line:
|
|
1910
|
+
line: 48,
|
|
1943
1911
|
scope: this,
|
|
1944
1912
|
callSite: (f, a) => f(...a)
|
|
1945
1913
|
});
|
|
@@ -1952,7 +1920,7 @@ var WebRTCTransport = class {
|
|
|
1952
1920
|
this._peer.on("connect", () => {
|
|
1953
1921
|
log10("connected", {}, {
|
|
1954
1922
|
file: "webrtc-transport.ts",
|
|
1955
|
-
line:
|
|
1923
|
+
line: 53,
|
|
1956
1924
|
scope: this,
|
|
1957
1925
|
callSite: (f, a) => f(...a)
|
|
1958
1926
|
});
|
|
@@ -1962,7 +1930,7 @@ var WebRTCTransport = class {
|
|
|
1962
1930
|
this._peer.on("close", async () => {
|
|
1963
1931
|
log10("closed", {}, {
|
|
1964
1932
|
file: "webrtc-transport.ts",
|
|
1965
|
-
line:
|
|
1933
|
+
line: 59,
|
|
1966
1934
|
scope: this,
|
|
1967
1935
|
callSite: (f, a) => f(...a)
|
|
1968
1936
|
});
|
|
@@ -1980,7 +1948,7 @@ var WebRTCTransport = class {
|
|
|
1980
1948
|
stats
|
|
1981
1949
|
}, {
|
|
1982
1950
|
file: "webrtc-transport.ts",
|
|
1983
|
-
line:
|
|
1951
|
+
line: 71,
|
|
1984
1952
|
scope: this,
|
|
1985
1953
|
callSite: (f, a) => f(...a)
|
|
1986
1954
|
});
|
|
@@ -1990,11 +1958,19 @@ var WebRTCTransport = class {
|
|
|
1990
1958
|
}
|
|
1991
1959
|
await this.destroy();
|
|
1992
1960
|
});
|
|
1961
|
+
log10.trace("dxos.mesh.webrtc-transport.constructor", trace4.end({
|
|
1962
|
+
id: this._instanceId
|
|
1963
|
+
}), {
|
|
1964
|
+
file: "webrtc-transport.ts",
|
|
1965
|
+
line: 81,
|
|
1966
|
+
scope: this,
|
|
1967
|
+
callSite: (f, a) => f(...a)
|
|
1968
|
+
});
|
|
1993
1969
|
}
|
|
1994
1970
|
async destroy() {
|
|
1995
1971
|
log10("closing...", {}, {
|
|
1996
1972
|
file: "webrtc-transport.ts",
|
|
1997
|
-
line:
|
|
1973
|
+
line: 85,
|
|
1998
1974
|
scope: this,
|
|
1999
1975
|
callSite: (f, a) => f(...a)
|
|
2000
1976
|
});
|
|
@@ -2004,18 +1980,7 @@ var WebRTCTransport = class {
|
|
|
2004
1980
|
this.closed.emit();
|
|
2005
1981
|
log10("closed", {}, {
|
|
2006
1982
|
file: "webrtc-transport.ts",
|
|
2007
|
-
line:
|
|
2008
|
-
scope: this,
|
|
2009
|
-
callSite: (f, a) => f(...a)
|
|
2010
|
-
});
|
|
2011
|
-
log10.trace("dxos.mesh.webrtc-transport", trace4.end({
|
|
2012
|
-
id: this._instanceId,
|
|
2013
|
-
data: {
|
|
2014
|
-
performance: this._performance
|
|
2015
|
-
}
|
|
2016
|
-
}), {
|
|
2017
|
-
file: "webrtc-transport.ts",
|
|
2018
|
-
line: 94,
|
|
1983
|
+
line: 90,
|
|
2019
1984
|
scope: this,
|
|
2020
1985
|
callSite: (f, a) => f(...a)
|
|
2021
1986
|
});
|
|
@@ -2327,4 +2292,4 @@ export {
|
|
|
2327
2292
|
WebRTCTransportProxyFactory,
|
|
2328
2293
|
createTeleportProtocolFactory
|
|
2329
2294
|
};
|
|
2330
|
-
//# sourceMappingURL=chunk-
|
|
2295
|
+
//# sourceMappingURL=chunk-UTCOIPSK.mjs.map
|