@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
package/dist/lib/node/index.cjs
CHANGED
|
@@ -137,6 +137,18 @@ var Connection = class {
|
|
|
137
137
|
await this._flushSignalBuffer();
|
|
138
138
|
});
|
|
139
139
|
this._signallingDelay = STARTING_SIGNALLING_DELAY;
|
|
140
|
+
import_log.log.trace("dxos.mesh.connection.construct", {
|
|
141
|
+
sessionId: this.sessionId,
|
|
142
|
+
topic: this.topic,
|
|
143
|
+
localPeerId: this.ownId,
|
|
144
|
+
remotePeerId: this.remoteId,
|
|
145
|
+
initiator: this.initiator
|
|
146
|
+
}, {
|
|
147
|
+
F: __dxlog_file,
|
|
148
|
+
L: 95,
|
|
149
|
+
S: this,
|
|
150
|
+
C: (f, a) => f(...a)
|
|
151
|
+
});
|
|
140
152
|
}
|
|
141
153
|
get state() {
|
|
142
154
|
return this._state;
|
|
@@ -153,7 +165,7 @@ var Connection = class {
|
|
|
153
165
|
async openConnection() {
|
|
154
166
|
(0, import_invariant.invariant)(this._state === ConnectionState.INITIAL, "Invalid state.", {
|
|
155
167
|
F: __dxlog_file,
|
|
156
|
-
L:
|
|
168
|
+
L: 120,
|
|
157
169
|
S: this,
|
|
158
170
|
A: [
|
|
159
171
|
"this._state === ConnectionState.INITIAL",
|
|
@@ -164,7 +176,19 @@ var Connection = class {
|
|
|
164
176
|
id: this._instanceId
|
|
165
177
|
}), {
|
|
166
178
|
F: __dxlog_file,
|
|
167
|
-
L:
|
|
179
|
+
L: 121,
|
|
180
|
+
S: this,
|
|
181
|
+
C: (f, a) => f(...a)
|
|
182
|
+
});
|
|
183
|
+
import_log.log.trace("dxos.mesh.connection.open", {
|
|
184
|
+
sessionId: this.sessionId,
|
|
185
|
+
topic: this.topic,
|
|
186
|
+
localPeerId: this.ownId,
|
|
187
|
+
remotePeerId: this.remoteId,
|
|
188
|
+
initiator: this.initiator
|
|
189
|
+
}, {
|
|
190
|
+
F: __dxlog_file,
|
|
191
|
+
L: 122,
|
|
168
192
|
S: this,
|
|
169
193
|
C: (f, a) => f(...a)
|
|
170
194
|
});
|
|
@@ -175,7 +199,7 @@ var Connection = class {
|
|
|
175
199
|
this._protocol.stream.on("close", () => {
|
|
176
200
|
(0, import_log.log)("protocol stream closed", void 0, {
|
|
177
201
|
F: __dxlog_file,
|
|
178
|
-
L:
|
|
202
|
+
L: 139,
|
|
179
203
|
S: this,
|
|
180
204
|
C: (f, a) => f(...a)
|
|
181
205
|
});
|
|
@@ -183,7 +207,7 @@ var Connection = class {
|
|
|
183
207
|
});
|
|
184
208
|
(0, import_invariant.invariant)(!this._transport, void 0, {
|
|
185
209
|
F: __dxlog_file,
|
|
186
|
-
L:
|
|
210
|
+
L: 143,
|
|
187
211
|
S: this,
|
|
188
212
|
A: [
|
|
189
213
|
"!this._transport",
|
|
@@ -215,7 +239,7 @@ var Connection = class {
|
|
|
215
239
|
id: this._instanceId
|
|
216
240
|
}), {
|
|
217
241
|
F: __dxlog_file,
|
|
218
|
-
L:
|
|
242
|
+
L: 172,
|
|
219
243
|
S: this,
|
|
220
244
|
C: (f, a) => f(...a)
|
|
221
245
|
});
|
|
@@ -231,7 +255,7 @@ var Connection = class {
|
|
|
231
255
|
peerId: this.ownId
|
|
232
256
|
}, {
|
|
233
257
|
F: __dxlog_file,
|
|
234
|
-
L:
|
|
258
|
+
L: 184,
|
|
235
259
|
S: this,
|
|
236
260
|
C: (f, a) => f(...a)
|
|
237
261
|
});
|
|
@@ -240,7 +264,7 @@ var Connection = class {
|
|
|
240
264
|
} catch (err) {
|
|
241
265
|
import_log.log.catch(err, void 0, {
|
|
242
266
|
F: __dxlog_file,
|
|
243
|
-
L:
|
|
267
|
+
L: 190,
|
|
244
268
|
S: this,
|
|
245
269
|
C: (f, a) => f(...a)
|
|
246
270
|
});
|
|
@@ -250,7 +274,7 @@ var Connection = class {
|
|
|
250
274
|
} catch (err) {
|
|
251
275
|
import_log.log.catch(err, void 0, {
|
|
252
276
|
F: __dxlog_file,
|
|
253
|
-
L:
|
|
277
|
+
L: 197,
|
|
254
278
|
S: this,
|
|
255
279
|
C: (f, a) => f(...a)
|
|
256
280
|
});
|
|
@@ -259,7 +283,7 @@ var Connection = class {
|
|
|
259
283
|
peerId: this.ownId
|
|
260
284
|
}, {
|
|
261
285
|
F: __dxlog_file,
|
|
262
|
-
L:
|
|
286
|
+
L: 200,
|
|
263
287
|
S: this,
|
|
264
288
|
C: (f, a) => f(...a)
|
|
265
289
|
});
|
|
@@ -299,7 +323,7 @@ var Connection = class {
|
|
|
299
323
|
err
|
|
300
324
|
}, {
|
|
301
325
|
F: __dxlog_file,
|
|
302
|
-
L:
|
|
326
|
+
L: 234,
|
|
303
327
|
S: this,
|
|
304
328
|
C: (f, a) => f(...a)
|
|
305
329
|
});
|
|
@@ -313,7 +337,7 @@ var Connection = class {
|
|
|
313
337
|
var _a, _b, _c;
|
|
314
338
|
(0, import_invariant.invariant)(msg.sessionId, void 0, {
|
|
315
339
|
F: __dxlog_file,
|
|
316
|
-
L:
|
|
340
|
+
L: 243,
|
|
317
341
|
S: this,
|
|
318
342
|
A: [
|
|
319
343
|
"msg.sessionId",
|
|
@@ -323,7 +347,7 @@ var Connection = class {
|
|
|
323
347
|
if (!msg.sessionId.equals(this.sessionId)) {
|
|
324
348
|
(0, import_log.log)("dropping signal for incorrect session id", void 0, {
|
|
325
349
|
F: __dxlog_file,
|
|
326
|
-
L:
|
|
350
|
+
L: 245,
|
|
327
351
|
S: this,
|
|
328
352
|
C: (f, a) => f(...a)
|
|
329
353
|
});
|
|
@@ -331,7 +355,7 @@ var Connection = class {
|
|
|
331
355
|
}
|
|
332
356
|
(0, import_invariant.invariant)(msg.data.signal || msg.data.signalBatch, void 0, {
|
|
333
357
|
F: __dxlog_file,
|
|
334
|
-
L:
|
|
358
|
+
L: 248,
|
|
335
359
|
S: this,
|
|
336
360
|
A: [
|
|
337
361
|
"msg.data.signal || msg.data.signalBatch",
|
|
@@ -340,7 +364,7 @@ var Connection = class {
|
|
|
340
364
|
});
|
|
341
365
|
(0, import_invariant.invariant)((_a = msg.author) == null ? void 0 : _a.equals(this.remoteId), void 0, {
|
|
342
366
|
F: __dxlog_file,
|
|
343
|
-
L:
|
|
367
|
+
L: 249,
|
|
344
368
|
S: this,
|
|
345
369
|
A: [
|
|
346
370
|
"msg.author?.equals(this.remoteId)",
|
|
@@ -349,7 +373,7 @@ var Connection = class {
|
|
|
349
373
|
});
|
|
350
374
|
(0, import_invariant.invariant)((_b = msg.recipient) == null ? void 0 : _b.equals(this.ownId), void 0, {
|
|
351
375
|
F: __dxlog_file,
|
|
352
|
-
L:
|
|
376
|
+
L: 250,
|
|
353
377
|
S: this,
|
|
354
378
|
A: [
|
|
355
379
|
"msg.recipient?.equals(this.ownId)",
|
|
@@ -370,7 +394,7 @@ var Connection = class {
|
|
|
370
394
|
msg: msg.data
|
|
371
395
|
}, {
|
|
372
396
|
F: __dxlog_file,
|
|
373
|
-
L:
|
|
397
|
+
L: 259,
|
|
374
398
|
S: this,
|
|
375
399
|
C: (f, a) => f(...a)
|
|
376
400
|
});
|
|
@@ -378,7 +402,7 @@ var Connection = class {
|
|
|
378
402
|
} else {
|
|
379
403
|
(0, import_invariant.invariant)(this._transport, "Connection not ready to accept signals.", {
|
|
380
404
|
F: __dxlog_file,
|
|
381
|
-
L:
|
|
405
|
+
L: 262,
|
|
382
406
|
S: this,
|
|
383
407
|
A: [
|
|
384
408
|
"this._transport",
|
|
@@ -391,7 +415,7 @@ var Connection = class {
|
|
|
391
415
|
msg: msg.data
|
|
392
416
|
}, {
|
|
393
417
|
F: __dxlog_file,
|
|
394
|
-
L:
|
|
418
|
+
L: 263,
|
|
395
419
|
S: this,
|
|
396
420
|
C: (f, a) => f(...a)
|
|
397
421
|
});
|
|
@@ -406,13 +430,13 @@ var Connection = class {
|
|
|
406
430
|
peerId: this.ownId
|
|
407
431
|
}, {
|
|
408
432
|
F: __dxlog_file,
|
|
409
|
-
L:
|
|
433
|
+
L: 270,
|
|
410
434
|
S: this,
|
|
411
435
|
C: (f, a) => f(...a)
|
|
412
436
|
});
|
|
413
437
|
(0, import_invariant.invariant)(state !== this._state, "Already in this state.", {
|
|
414
438
|
F: __dxlog_file,
|
|
415
|
-
L:
|
|
439
|
+
L: 271,
|
|
416
440
|
S: this,
|
|
417
441
|
A: [
|
|
418
442
|
"state !== this._state",
|
|
@@ -920,6 +944,18 @@ var Peer = class {
|
|
|
920
944
|
this._lastConnectionTime = Date.now();
|
|
921
945
|
this._callbacks.onConnected();
|
|
922
946
|
this._connectionLimiter.doneConnecting(sessionId);
|
|
947
|
+
import_log3.log.trace("dxos.mesh.connection.connected", {
|
|
948
|
+
topic: this.topic,
|
|
949
|
+
localPeerId: this.localPeerId,
|
|
950
|
+
remotePeerId: this.id,
|
|
951
|
+
sessionId,
|
|
952
|
+
initiator
|
|
953
|
+
}, {
|
|
954
|
+
F: __dxlog_file3,
|
|
955
|
+
L: 229,
|
|
956
|
+
S: this,
|
|
957
|
+
C: (f, a) => f(...a)
|
|
958
|
+
});
|
|
923
959
|
break;
|
|
924
960
|
}
|
|
925
961
|
case ConnectionState.CLOSED: {
|
|
@@ -930,19 +966,31 @@ var Peer = class {
|
|
|
930
966
|
initiator
|
|
931
967
|
}, {
|
|
932
968
|
F: __dxlog_file3,
|
|
933
|
-
L:
|
|
969
|
+
L: 240,
|
|
934
970
|
S: this,
|
|
935
971
|
C: (f, a) => f(...a)
|
|
936
972
|
});
|
|
937
973
|
(0, import_invariant3.invariant)(this.connection === connection, "Connection mismatch (race condition).", {
|
|
938
974
|
F: __dxlog_file3,
|
|
939
|
-
L:
|
|
975
|
+
L: 241,
|
|
940
976
|
S: this,
|
|
941
977
|
A: [
|
|
942
978
|
"this.connection === connection",
|
|
943
979
|
"'Connection mismatch (race condition).'"
|
|
944
980
|
]
|
|
945
981
|
});
|
|
982
|
+
import_log3.log.trace("dxos.mesh.connection.closed", {
|
|
983
|
+
topic: this.topic,
|
|
984
|
+
localPeerId: this.localPeerId,
|
|
985
|
+
remotePeerId: this.id,
|
|
986
|
+
sessionId,
|
|
987
|
+
initiator
|
|
988
|
+
}, {
|
|
989
|
+
F: __dxlog_file3,
|
|
990
|
+
L: 243,
|
|
991
|
+
S: this,
|
|
992
|
+
C: (f, a) => f(...a)
|
|
993
|
+
});
|
|
946
994
|
if (this._lastConnectionTime && this._lastConnectionTime + CONNECTION_COUNTS_STABLE_AFTER < Date.now()) {
|
|
947
995
|
this._availableAfter = 0;
|
|
948
996
|
} else {
|
|
@@ -969,7 +1017,20 @@ var Peer = class {
|
|
|
969
1017
|
err
|
|
970
1018
|
}, {
|
|
971
1019
|
F: __dxlog_file3,
|
|
972
|
-
L:
|
|
1020
|
+
L: 277,
|
|
1021
|
+
S: this,
|
|
1022
|
+
C: (f, a) => f(...a)
|
|
1023
|
+
});
|
|
1024
|
+
import_log3.log.trace("dxos.mesh.connection.error", {
|
|
1025
|
+
topic: this.topic,
|
|
1026
|
+
localPeerId: this.localPeerId,
|
|
1027
|
+
remotePeerId: this.id,
|
|
1028
|
+
sessionId,
|
|
1029
|
+
initiator,
|
|
1030
|
+
err
|
|
1031
|
+
}, {
|
|
1032
|
+
F: __dxlog_file3,
|
|
1033
|
+
L: 278,
|
|
973
1034
|
S: this,
|
|
974
1035
|
C: (f, a) => f(...a)
|
|
975
1036
|
});
|
|
@@ -988,7 +1049,7 @@ var Peer = class {
|
|
|
988
1049
|
sessionId: connection.sessionId
|
|
989
1050
|
}, {
|
|
990
1051
|
F: __dxlog_file3,
|
|
991
|
-
L:
|
|
1052
|
+
L: 301,
|
|
992
1053
|
S: this,
|
|
993
1054
|
C: (f, a) => f(...a)
|
|
994
1055
|
});
|
|
@@ -998,7 +1059,7 @@ var Peer = class {
|
|
|
998
1059
|
sessionId: connection.sessionId
|
|
999
1060
|
}, {
|
|
1000
1061
|
F: __dxlog_file3,
|
|
1001
|
-
L:
|
|
1062
|
+
L: 307,
|
|
1002
1063
|
S: this,
|
|
1003
1064
|
C: (f, a) => f(...a)
|
|
1004
1065
|
});
|
|
@@ -1009,7 +1070,7 @@ var Peer = class {
|
|
|
1009
1070
|
message
|
|
1010
1071
|
}, {
|
|
1011
1072
|
F: __dxlog_file3,
|
|
1012
|
-
L:
|
|
1073
|
+
L: 312,
|
|
1013
1074
|
S: this,
|
|
1014
1075
|
C: (f, a) => f(...a)
|
|
1015
1076
|
});
|
|
@@ -1025,7 +1086,7 @@ var Peer = class {
|
|
|
1025
1086
|
topic: this.topic
|
|
1026
1087
|
}, {
|
|
1027
1088
|
F: __dxlog_file3,
|
|
1028
|
-
L:
|
|
1089
|
+
L: 322,
|
|
1029
1090
|
S: this,
|
|
1030
1091
|
C: (f, a) => f(...a)
|
|
1031
1092
|
});
|