@dxos/network-manager 0.1.56-main.bf228a7 → 0.1.56-main.c19b7cd
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-FYPOLWVS.mjs → chunk-FC6CWDES.mjs} +89 -28
- package/dist/lib/browser/chunk-FC6CWDES.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 +1 -1
- package/dist/lib/node/index.cjs +88 -27
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +88 -27
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/swarm/connection.d.ts.map +1 -1
- package/dist/types/src/swarm/peer.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/swarm/connection.ts +16 -1
- package/src/swarm/peer.ts +23 -0
- package/dist/lib/browser/chunk-FYPOLWVS.mjs.map +0 -7
|
@@ -84,6 +84,18 @@ var Connection = class {
|
|
|
84
84
|
await this._flushSignalBuffer();
|
|
85
85
|
});
|
|
86
86
|
this._signallingDelay = STARTING_SIGNALLING_DELAY;
|
|
87
|
+
log.trace("dxos.mesh.connection.construct", {
|
|
88
|
+
sessionId: this.sessionId,
|
|
89
|
+
topic: this.topic,
|
|
90
|
+
localPeerId: this.ownId,
|
|
91
|
+
remotePeerId: this.remoteId,
|
|
92
|
+
initiator: this.initiator
|
|
93
|
+
}, {
|
|
94
|
+
F: __dxlog_file,
|
|
95
|
+
L: 95,
|
|
96
|
+
S: this,
|
|
97
|
+
C: (f, a) => f(...a)
|
|
98
|
+
});
|
|
87
99
|
}
|
|
88
100
|
get state() {
|
|
89
101
|
return this._state;
|
|
@@ -100,7 +112,7 @@ var Connection = class {
|
|
|
100
112
|
async openConnection() {
|
|
101
113
|
invariant(this._state === ConnectionState.INITIAL, "Invalid state.", {
|
|
102
114
|
F: __dxlog_file,
|
|
103
|
-
L:
|
|
115
|
+
L: 120,
|
|
104
116
|
S: this,
|
|
105
117
|
A: [
|
|
106
118
|
"this._state === ConnectionState.INITIAL",
|
|
@@ -111,7 +123,19 @@ var Connection = class {
|
|
|
111
123
|
id: this._instanceId
|
|
112
124
|
}), {
|
|
113
125
|
F: __dxlog_file,
|
|
114
|
-
L:
|
|
126
|
+
L: 121,
|
|
127
|
+
S: this,
|
|
128
|
+
C: (f, a) => f(...a)
|
|
129
|
+
});
|
|
130
|
+
log.trace("dxos.mesh.connection.open", {
|
|
131
|
+
sessionId: this.sessionId,
|
|
132
|
+
topic: this.topic,
|
|
133
|
+
localPeerId: this.ownId,
|
|
134
|
+
remotePeerId: this.remoteId,
|
|
135
|
+
initiator: this.initiator
|
|
136
|
+
}, {
|
|
137
|
+
F: __dxlog_file,
|
|
138
|
+
L: 122,
|
|
115
139
|
S: this,
|
|
116
140
|
C: (f, a) => f(...a)
|
|
117
141
|
});
|
|
@@ -122,7 +146,7 @@ var Connection = class {
|
|
|
122
146
|
this._protocol.stream.on("close", () => {
|
|
123
147
|
log("protocol stream closed", void 0, {
|
|
124
148
|
F: __dxlog_file,
|
|
125
|
-
L:
|
|
149
|
+
L: 139,
|
|
126
150
|
S: this,
|
|
127
151
|
C: (f, a) => f(...a)
|
|
128
152
|
});
|
|
@@ -130,7 +154,7 @@ var Connection = class {
|
|
|
130
154
|
});
|
|
131
155
|
invariant(!this._transport, void 0, {
|
|
132
156
|
F: __dxlog_file,
|
|
133
|
-
L:
|
|
157
|
+
L: 143,
|
|
134
158
|
S: this,
|
|
135
159
|
A: [
|
|
136
160
|
"!this._transport",
|
|
@@ -162,7 +186,7 @@ var Connection = class {
|
|
|
162
186
|
id: this._instanceId
|
|
163
187
|
}), {
|
|
164
188
|
F: __dxlog_file,
|
|
165
|
-
L:
|
|
189
|
+
L: 172,
|
|
166
190
|
S: this,
|
|
167
191
|
C: (f, a) => f(...a)
|
|
168
192
|
});
|
|
@@ -178,7 +202,7 @@ var Connection = class {
|
|
|
178
202
|
peerId: this.ownId
|
|
179
203
|
}, {
|
|
180
204
|
F: __dxlog_file,
|
|
181
|
-
L:
|
|
205
|
+
L: 184,
|
|
182
206
|
S: this,
|
|
183
207
|
C: (f, a) => f(...a)
|
|
184
208
|
});
|
|
@@ -187,7 +211,7 @@ var Connection = class {
|
|
|
187
211
|
} catch (err) {
|
|
188
212
|
log.catch(err, void 0, {
|
|
189
213
|
F: __dxlog_file,
|
|
190
|
-
L:
|
|
214
|
+
L: 190,
|
|
191
215
|
S: this,
|
|
192
216
|
C: (f, a) => f(...a)
|
|
193
217
|
});
|
|
@@ -197,7 +221,7 @@ var Connection = class {
|
|
|
197
221
|
} catch (err) {
|
|
198
222
|
log.catch(err, void 0, {
|
|
199
223
|
F: __dxlog_file,
|
|
200
|
-
L:
|
|
224
|
+
L: 197,
|
|
201
225
|
S: this,
|
|
202
226
|
C: (f, a) => f(...a)
|
|
203
227
|
});
|
|
@@ -206,7 +230,7 @@ var Connection = class {
|
|
|
206
230
|
peerId: this.ownId
|
|
207
231
|
}, {
|
|
208
232
|
F: __dxlog_file,
|
|
209
|
-
L:
|
|
233
|
+
L: 200,
|
|
210
234
|
S: this,
|
|
211
235
|
C: (f, a) => f(...a)
|
|
212
236
|
});
|
|
@@ -246,7 +270,7 @@ var Connection = class {
|
|
|
246
270
|
err
|
|
247
271
|
}, {
|
|
248
272
|
F: __dxlog_file,
|
|
249
|
-
L:
|
|
273
|
+
L: 234,
|
|
250
274
|
S: this,
|
|
251
275
|
C: (f, a) => f(...a)
|
|
252
276
|
});
|
|
@@ -260,7 +284,7 @@ var Connection = class {
|
|
|
260
284
|
var _a, _b, _c;
|
|
261
285
|
invariant(msg.sessionId, void 0, {
|
|
262
286
|
F: __dxlog_file,
|
|
263
|
-
L:
|
|
287
|
+
L: 243,
|
|
264
288
|
S: this,
|
|
265
289
|
A: [
|
|
266
290
|
"msg.sessionId",
|
|
@@ -270,7 +294,7 @@ var Connection = class {
|
|
|
270
294
|
if (!msg.sessionId.equals(this.sessionId)) {
|
|
271
295
|
log("dropping signal for incorrect session id", void 0, {
|
|
272
296
|
F: __dxlog_file,
|
|
273
|
-
L:
|
|
297
|
+
L: 245,
|
|
274
298
|
S: this,
|
|
275
299
|
C: (f, a) => f(...a)
|
|
276
300
|
});
|
|
@@ -278,7 +302,7 @@ var Connection = class {
|
|
|
278
302
|
}
|
|
279
303
|
invariant(msg.data.signal || msg.data.signalBatch, void 0, {
|
|
280
304
|
F: __dxlog_file,
|
|
281
|
-
L:
|
|
305
|
+
L: 248,
|
|
282
306
|
S: this,
|
|
283
307
|
A: [
|
|
284
308
|
"msg.data.signal || msg.data.signalBatch",
|
|
@@ -287,7 +311,7 @@ var Connection = class {
|
|
|
287
311
|
});
|
|
288
312
|
invariant((_a = msg.author) == null ? void 0 : _a.equals(this.remoteId), void 0, {
|
|
289
313
|
F: __dxlog_file,
|
|
290
|
-
L:
|
|
314
|
+
L: 249,
|
|
291
315
|
S: this,
|
|
292
316
|
A: [
|
|
293
317
|
"msg.author?.equals(this.remoteId)",
|
|
@@ -296,7 +320,7 @@ var Connection = class {
|
|
|
296
320
|
});
|
|
297
321
|
invariant((_b = msg.recipient) == null ? void 0 : _b.equals(this.ownId), void 0, {
|
|
298
322
|
F: __dxlog_file,
|
|
299
|
-
L:
|
|
323
|
+
L: 250,
|
|
300
324
|
S: this,
|
|
301
325
|
A: [
|
|
302
326
|
"msg.recipient?.equals(this.ownId)",
|
|
@@ -317,7 +341,7 @@ var Connection = class {
|
|
|
317
341
|
msg: msg.data
|
|
318
342
|
}, {
|
|
319
343
|
F: __dxlog_file,
|
|
320
|
-
L:
|
|
344
|
+
L: 259,
|
|
321
345
|
S: this,
|
|
322
346
|
C: (f, a) => f(...a)
|
|
323
347
|
});
|
|
@@ -325,7 +349,7 @@ var Connection = class {
|
|
|
325
349
|
} else {
|
|
326
350
|
invariant(this._transport, "Connection not ready to accept signals.", {
|
|
327
351
|
F: __dxlog_file,
|
|
328
|
-
L:
|
|
352
|
+
L: 262,
|
|
329
353
|
S: this,
|
|
330
354
|
A: [
|
|
331
355
|
"this._transport",
|
|
@@ -338,7 +362,7 @@ var Connection = class {
|
|
|
338
362
|
msg: msg.data
|
|
339
363
|
}, {
|
|
340
364
|
F: __dxlog_file,
|
|
341
|
-
L:
|
|
365
|
+
L: 263,
|
|
342
366
|
S: this,
|
|
343
367
|
C: (f, a) => f(...a)
|
|
344
368
|
});
|
|
@@ -353,13 +377,13 @@ var Connection = class {
|
|
|
353
377
|
peerId: this.ownId
|
|
354
378
|
}, {
|
|
355
379
|
F: __dxlog_file,
|
|
356
|
-
L:
|
|
380
|
+
L: 270,
|
|
357
381
|
S: this,
|
|
358
382
|
C: (f, a) => f(...a)
|
|
359
383
|
});
|
|
360
384
|
invariant(state !== this._state, "Already in this state.", {
|
|
361
385
|
F: __dxlog_file,
|
|
362
|
-
L:
|
|
386
|
+
L: 271,
|
|
363
387
|
S: this,
|
|
364
388
|
A: [
|
|
365
389
|
"state !== this._state",
|
|
@@ -867,6 +891,18 @@ var Peer = class {
|
|
|
867
891
|
this._lastConnectionTime = Date.now();
|
|
868
892
|
this._callbacks.onConnected();
|
|
869
893
|
this._connectionLimiter.doneConnecting(sessionId);
|
|
894
|
+
log3.trace("dxos.mesh.connection.connected", {
|
|
895
|
+
topic: this.topic,
|
|
896
|
+
localPeerId: this.localPeerId,
|
|
897
|
+
remotePeerId: this.id,
|
|
898
|
+
sessionId,
|
|
899
|
+
initiator
|
|
900
|
+
}, {
|
|
901
|
+
F: __dxlog_file3,
|
|
902
|
+
L: 229,
|
|
903
|
+
S: this,
|
|
904
|
+
C: (f, a) => f(...a)
|
|
905
|
+
});
|
|
870
906
|
break;
|
|
871
907
|
}
|
|
872
908
|
case ConnectionState.CLOSED: {
|
|
@@ -877,19 +913,31 @@ var Peer = class {
|
|
|
877
913
|
initiator
|
|
878
914
|
}, {
|
|
879
915
|
F: __dxlog_file3,
|
|
880
|
-
L:
|
|
916
|
+
L: 240,
|
|
881
917
|
S: this,
|
|
882
918
|
C: (f, a) => f(...a)
|
|
883
919
|
});
|
|
884
920
|
invariant3(this.connection === connection, "Connection mismatch (race condition).", {
|
|
885
921
|
F: __dxlog_file3,
|
|
886
|
-
L:
|
|
922
|
+
L: 241,
|
|
887
923
|
S: this,
|
|
888
924
|
A: [
|
|
889
925
|
"this.connection === connection",
|
|
890
926
|
"'Connection mismatch (race condition).'"
|
|
891
927
|
]
|
|
892
928
|
});
|
|
929
|
+
log3.trace("dxos.mesh.connection.closed", {
|
|
930
|
+
topic: this.topic,
|
|
931
|
+
localPeerId: this.localPeerId,
|
|
932
|
+
remotePeerId: this.id,
|
|
933
|
+
sessionId,
|
|
934
|
+
initiator
|
|
935
|
+
}, {
|
|
936
|
+
F: __dxlog_file3,
|
|
937
|
+
L: 243,
|
|
938
|
+
S: this,
|
|
939
|
+
C: (f, a) => f(...a)
|
|
940
|
+
});
|
|
893
941
|
if (this._lastConnectionTime && this._lastConnectionTime + CONNECTION_COUNTS_STABLE_AFTER < Date.now()) {
|
|
894
942
|
this._availableAfter = 0;
|
|
895
943
|
} else {
|
|
@@ -916,7 +964,20 @@ var Peer = class {
|
|
|
916
964
|
err
|
|
917
965
|
}, {
|
|
918
966
|
F: __dxlog_file3,
|
|
919
|
-
L:
|
|
967
|
+
L: 277,
|
|
968
|
+
S: this,
|
|
969
|
+
C: (f, a) => f(...a)
|
|
970
|
+
});
|
|
971
|
+
log3.trace("dxos.mesh.connection.error", {
|
|
972
|
+
topic: this.topic,
|
|
973
|
+
localPeerId: this.localPeerId,
|
|
974
|
+
remotePeerId: this.id,
|
|
975
|
+
sessionId,
|
|
976
|
+
initiator,
|
|
977
|
+
err
|
|
978
|
+
}, {
|
|
979
|
+
F: __dxlog_file3,
|
|
980
|
+
L: 278,
|
|
920
981
|
S: this,
|
|
921
982
|
C: (f, a) => f(...a)
|
|
922
983
|
});
|
|
@@ -935,7 +996,7 @@ var Peer = class {
|
|
|
935
996
|
sessionId: connection.sessionId
|
|
936
997
|
}, {
|
|
937
998
|
F: __dxlog_file3,
|
|
938
|
-
L:
|
|
999
|
+
L: 301,
|
|
939
1000
|
S: this,
|
|
940
1001
|
C: (f, a) => f(...a)
|
|
941
1002
|
});
|
|
@@ -945,7 +1006,7 @@ var Peer = class {
|
|
|
945
1006
|
sessionId: connection.sessionId
|
|
946
1007
|
}, {
|
|
947
1008
|
F: __dxlog_file3,
|
|
948
|
-
L:
|
|
1009
|
+
L: 307,
|
|
949
1010
|
S: this,
|
|
950
1011
|
C: (f, a) => f(...a)
|
|
951
1012
|
});
|
|
@@ -956,7 +1017,7 @@ var Peer = class {
|
|
|
956
1017
|
message
|
|
957
1018
|
}, {
|
|
958
1019
|
F: __dxlog_file3,
|
|
959
|
-
L:
|
|
1020
|
+
L: 312,
|
|
960
1021
|
S: this,
|
|
961
1022
|
C: (f, a) => f(...a)
|
|
962
1023
|
});
|
|
@@ -972,7 +1033,7 @@ var Peer = class {
|
|
|
972
1033
|
topic: this.topic
|
|
973
1034
|
}, {
|
|
974
1035
|
F: __dxlog_file3,
|
|
975
|
-
L:
|
|
1036
|
+
L: 322,
|
|
976
1037
|
S: this,
|
|
977
1038
|
C: (f, a) => f(...a)
|
|
978
1039
|
});
|
|
@@ -2866,4 +2927,4 @@ export {
|
|
|
2866
2927
|
WebRTCTransportProxyFactory,
|
|
2867
2928
|
createTeleportProtocolFactory
|
|
2868
2929
|
};
|
|
2869
|
-
//# sourceMappingURL=chunk-
|
|
2930
|
+
//# sourceMappingURL=chunk-FC6CWDES.mjs.map
|