@dxos/network-manager 0.1.58-main.e4cedde → 0.1.58-main.eedac7a
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-PSWNMALH.mjs → chunk-XRCMC23N.mjs} +35 -27
- package/dist/lib/browser/chunk-XRCMC23N.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 +60 -52
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +63 -55
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/swarm/connection-limiter.d.ts +1 -1
- package/dist/types/src/swarm/connection-limiter.d.ts.map +1 -1
- package/dist/types/src/swarm/connection.d.ts.map +1 -1
- package/dist/types/src/swarm/peer.d.ts +1 -1
- package/dist/types/src/swarm/peer.d.ts.map +1 -1
- package/dist/types/src/transport/simplepeer-transport.d.ts.map +1 -1
- package/package.json +17 -18
- package/src/swarm/connection-limiter.ts +2 -2
- package/src/swarm/connection.ts +5 -5
- package/src/swarm/peer.ts +1 -1
- package/src/transport/simplepeer-transport-proxy.ts +9 -9
- package/src/transport/simplepeer-transport.ts +4 -7
- package/dist/lib/browser/chunk-PSWNMALH.mjs.map +0 -7
|
@@ -7,11 +7,10 @@ import {
|
|
|
7
7
|
import { DeferredTask, Event, sleep, synchronized } from "@dxos/async";
|
|
8
8
|
import { Context, cancelWithContext } from "@dxos/context";
|
|
9
9
|
import { ErrorStream } from "@dxos/debug";
|
|
10
|
-
import { CancelledError, ProtocolError, ConnectionResetError, ConnectivityError, UnknownProtocolError } from "@dxos/errors";
|
|
11
10
|
import { invariant } from "@dxos/invariant";
|
|
12
11
|
import { PublicKey } from "@dxos/keys";
|
|
13
12
|
import { log } from "@dxos/log";
|
|
14
|
-
import { trace } from "@dxos/protocols";
|
|
13
|
+
import { CancelledError, ProtocolError, ConnectionResetError, ConnectivityError, UnknownProtocolError, trace } from "@dxos/protocols";
|
|
15
14
|
function _ts_decorate(decorators, target, key, desc) {
|
|
16
15
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17
16
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -771,10 +770,10 @@ import { ComplexMap as ComplexMap2, isNotNullOrUndefined } from "@dxos/util";
|
|
|
771
770
|
// packages/core/mesh/network-manager/src/swarm/peer.ts
|
|
772
771
|
import { Event as Event2, scheduleTask, synchronized as synchronized2 } from "@dxos/async";
|
|
773
772
|
import { Context as Context3 } from "@dxos/context";
|
|
774
|
-
import { CancelledError as CancelledError2, SystemError, TimeoutError } from "@dxos/errors";
|
|
775
773
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
776
774
|
import { PublicKey as PublicKey3 } from "@dxos/keys";
|
|
777
775
|
import { log as log3 } from "@dxos/log";
|
|
776
|
+
import { CancelledError as CancelledError2, SystemError, TimeoutError } from "@dxos/protocols";
|
|
778
777
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
779
778
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
780
779
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1742,13 +1741,13 @@ var SwarmMapper = class {
|
|
|
1742
1741
|
// packages/core/mesh/network-manager/src/swarm/connection-limiter.ts
|
|
1743
1742
|
import { DeferredTask as DeferredTask2 } from "@dxos/async";
|
|
1744
1743
|
import { Context as Context5 } from "@dxos/context";
|
|
1745
|
-
import { CancelledError as CancelledError3 } from "@dxos/errors";
|
|
1746
1744
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
1747
1745
|
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
1748
1746
|
import { log as log6 } from "@dxos/log";
|
|
1747
|
+
import { CancelledError as CancelledError3 } from "@dxos/protocols";
|
|
1749
1748
|
import { ComplexMap as ComplexMap4 } from "@dxos/util";
|
|
1750
1749
|
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection-limiter.ts";
|
|
1751
|
-
var MAX_CONCURRENT_INITIATING_CONNECTIONS =
|
|
1750
|
+
var MAX_CONCURRENT_INITIATING_CONNECTIONS = 50;
|
|
1752
1751
|
var ConnectionLimiter = class {
|
|
1753
1752
|
constructor({ maxConcurrentInitConnections = MAX_CONCURRENT_INITIATING_CONNECTIONS } = {}) {
|
|
1754
1753
|
this._ctx = new Context5();
|
|
@@ -2583,10 +2582,9 @@ import SimplePeerConstructor from "simple-peer";
|
|
|
2583
2582
|
import invariant11 from "tiny-invariant";
|
|
2584
2583
|
import { Event as Event8 } from "@dxos/async";
|
|
2585
2584
|
import { ErrorStream as ErrorStream4, raise as raise2 } from "@dxos/debug";
|
|
2586
|
-
import { ConnectionResetError as ConnectionResetError2, ConnectivityError as ConnectivityError2, ProtocolError as ProtocolError2, UnknownProtocolError as UnknownProtocolError2 } from "@dxos/errors";
|
|
2587
2585
|
import { PublicKey as PublicKey10 } from "@dxos/keys";
|
|
2588
2586
|
import { log as log11 } from "@dxos/log";
|
|
2589
|
-
import { trace as trace4 } from "@dxos/protocols";
|
|
2587
|
+
import { ConnectionResetError as ConnectionResetError2, ConnectivityError as ConnectivityError2, ProtocolError as ProtocolError2, UnknownProtocolError as UnknownProtocolError2, trace as trace4 } from "@dxos/protocols";
|
|
2590
2588
|
|
|
2591
2589
|
// packages/core/mesh/network-manager/src/transport/webrtc.ts
|
|
2592
2590
|
var wrtc = null;
|
|
@@ -2609,13 +2607,13 @@ var SimplePeerTransport = class {
|
|
|
2609
2607
|
id: this._instanceId
|
|
2610
2608
|
}), {
|
|
2611
2609
|
F: __dxlog_file12,
|
|
2612
|
-
L:
|
|
2610
|
+
L: 40,
|
|
2613
2611
|
S: this,
|
|
2614
2612
|
C: (f, a) => f(...a)
|
|
2615
2613
|
});
|
|
2616
2614
|
log11("created connection", params, {
|
|
2617
2615
|
F: __dxlog_file12,
|
|
2618
|
-
L:
|
|
2616
|
+
L: 41,
|
|
2619
2617
|
S: this,
|
|
2620
2618
|
C: (f, a) => f(...a)
|
|
2621
2619
|
});
|
|
@@ -2628,7 +2626,7 @@ var SimplePeerTransport = class {
|
|
|
2628
2626
|
this._peer.on("signal", async (data) => {
|
|
2629
2627
|
log11("signal", data, {
|
|
2630
2628
|
F: __dxlog_file12,
|
|
2631
|
-
L:
|
|
2629
|
+
L: 50,
|
|
2632
2630
|
S: this,
|
|
2633
2631
|
C: (f, a) => f(...a)
|
|
2634
2632
|
});
|
|
@@ -2641,7 +2639,7 @@ var SimplePeerTransport = class {
|
|
|
2641
2639
|
this._peer.on("connect", () => {
|
|
2642
2640
|
log11("connected", void 0, {
|
|
2643
2641
|
F: __dxlog_file12,
|
|
2644
|
-
L:
|
|
2642
|
+
L: 55,
|
|
2645
2643
|
S: this,
|
|
2646
2644
|
C: (f, a) => f(...a)
|
|
2647
2645
|
});
|
|
@@ -2651,7 +2649,7 @@ var SimplePeerTransport = class {
|
|
|
2651
2649
|
this._peer.on("close", async () => {
|
|
2652
2650
|
log11("closed", void 0, {
|
|
2653
2651
|
F: __dxlog_file12,
|
|
2654
|
-
L:
|
|
2652
|
+
L: 61,
|
|
2655
2653
|
S: this,
|
|
2656
2654
|
C: (f, a) => f(...a)
|
|
2657
2655
|
});
|
|
@@ -2665,9 +2663,13 @@ var SimplePeerTransport = class {
|
|
|
2665
2663
|
} else {
|
|
2666
2664
|
this.errors.raise(new UnknownProtocolError2("unknown RTCError", err));
|
|
2667
2665
|
}
|
|
2668
|
-
} else if (err.name === "InvalidStateError") {
|
|
2669
|
-
this.errors.raise(new ConnectionResetError2("safari WebRTC error", err));
|
|
2670
2666
|
} else if ("code" in err) {
|
|
2667
|
+
log11.info("simple-peer error", err, {
|
|
2668
|
+
F: __dxlog_file12,
|
|
2669
|
+
L: 77,
|
|
2670
|
+
S: this,
|
|
2671
|
+
C: (f, a) => f(...a)
|
|
2672
|
+
});
|
|
2671
2673
|
switch (err.code) {
|
|
2672
2674
|
case "ERR_WEBRTC_SUPPORT":
|
|
2673
2675
|
this.errors.raise(new ProtocolError2("WebRTC not supported", err));
|
|
@@ -2686,17 +2688,23 @@ var SimplePeerTransport = class {
|
|
|
2686
2688
|
this.errors.raise(new Error("unknown simple-peer error"));
|
|
2687
2689
|
}
|
|
2688
2690
|
} else {
|
|
2691
|
+
log11.info("unknown peer connection error", err, {
|
|
2692
|
+
F: __dxlog_file12,
|
|
2693
|
+
L: 96,
|
|
2694
|
+
S: this,
|
|
2695
|
+
C: (f, a) => f(...a)
|
|
2696
|
+
});
|
|
2689
2697
|
this.errors.raise(err);
|
|
2690
2698
|
}
|
|
2691
2699
|
try {
|
|
2692
|
-
if (typeof this._peer?._pc
|
|
2700
|
+
if (typeof this._peer?._pc?.getStats === "function") {
|
|
2693
2701
|
this._peer._pc.getStats().then((stats) => {
|
|
2694
2702
|
log11.warn("report after webrtc error", {
|
|
2695
2703
|
config: this.params.webrtcConfig,
|
|
2696
2704
|
stats
|
|
2697
2705
|
}, {
|
|
2698
2706
|
F: __dxlog_file12,
|
|
2699
|
-
L:
|
|
2707
|
+
L: 104,
|
|
2700
2708
|
S: this,
|
|
2701
2709
|
C: (f, a) => f(...a)
|
|
2702
2710
|
});
|
|
@@ -2705,7 +2713,7 @@ var SimplePeerTransport = class {
|
|
|
2705
2713
|
} catch (err2) {
|
|
2706
2714
|
log11.catch(err2, void 0, {
|
|
2707
2715
|
F: __dxlog_file12,
|
|
2708
|
-
L:
|
|
2716
|
+
L: 111,
|
|
2709
2717
|
S: this,
|
|
2710
2718
|
C: (f, a) => f(...a)
|
|
2711
2719
|
});
|
|
@@ -2716,7 +2724,7 @@ var SimplePeerTransport = class {
|
|
|
2716
2724
|
id: this._instanceId
|
|
2717
2725
|
}), {
|
|
2718
2726
|
F: __dxlog_file12,
|
|
2719
|
-
L:
|
|
2727
|
+
L: 116,
|
|
2720
2728
|
S: this,
|
|
2721
2729
|
C: (f, a) => f(...a)
|
|
2722
2730
|
});
|
|
@@ -2724,7 +2732,7 @@ var SimplePeerTransport = class {
|
|
|
2724
2732
|
async destroy() {
|
|
2725
2733
|
log11("closing...", void 0, {
|
|
2726
2734
|
F: __dxlog_file12,
|
|
2727
|
-
L:
|
|
2735
|
+
L: 120,
|
|
2728
2736
|
S: this,
|
|
2729
2737
|
C: (f, a) => f(...a)
|
|
2730
2738
|
});
|
|
@@ -2734,7 +2742,7 @@ var SimplePeerTransport = class {
|
|
|
2734
2742
|
this.closed.emit();
|
|
2735
2743
|
log11("closed", void 0, {
|
|
2736
2744
|
F: __dxlog_file12,
|
|
2737
|
-
L:
|
|
2745
|
+
L: 125,
|
|
2738
2746
|
S: this,
|
|
2739
2747
|
C: (f, a) => f(...a)
|
|
2740
2748
|
});
|
|
@@ -2892,10 +2900,10 @@ import { Writable } from "@dxos/node-std/stream";
|
|
|
2892
2900
|
import { Event as Event9 } from "@dxos/async";
|
|
2893
2901
|
import { Context as Context6 } from "@dxos/context";
|
|
2894
2902
|
import { ErrorStream as ErrorStream5 } from "@dxos/debug";
|
|
2895
|
-
import { ConnectionResetError as ConnectionResetError3, TimeoutError as TimeoutError2, ProtocolError as ProtocolError3, ConnectivityError as ConnectivityError3, UnknownProtocolError as UnknownProtocolError3 } from "@dxos/errors";
|
|
2896
2903
|
import { invariant as invariant13 } from "@dxos/invariant";
|
|
2897
2904
|
import { PublicKey as PublicKey12 } from "@dxos/keys";
|
|
2898
2905
|
import { log as log13 } from "@dxos/log";
|
|
2906
|
+
import { ConnectionResetError as ConnectionResetError3, TimeoutError as TimeoutError2, ProtocolError as ProtocolError3, ConnectivityError as ConnectivityError3, UnknownProtocolError as UnknownProtocolError3 } from "@dxos/protocols";
|
|
2899
2907
|
import { ConnectionState as ConnectionState4 } from "@dxos/protocols/proto/dxos/mesh/bridge";
|
|
2900
2908
|
import { arrayToBuffer } from "@dxos/util";
|
|
2901
2909
|
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport-proxy.ts";
|
|
@@ -3046,15 +3054,15 @@ var SimplePeerTransportProxyFactory = class {
|
|
|
3046
3054
|
};
|
|
3047
3055
|
var decodeError = (err) => {
|
|
3048
3056
|
const message = typeof err === "string" ? err : err.message;
|
|
3049
|
-
if (message.includes("
|
|
3057
|
+
if (message.includes("CONNECTION_RESET")) {
|
|
3050
3058
|
return new ConnectionResetError3(message);
|
|
3051
|
-
} else if (message.includes("
|
|
3059
|
+
} else if (message.includes("TIMEOUT")) {
|
|
3052
3060
|
return new TimeoutError2(message);
|
|
3053
|
-
} else if (message.includes("
|
|
3061
|
+
} else if (message.includes("PROTOCOL_ERROR")) {
|
|
3054
3062
|
return new ProtocolError3(message);
|
|
3055
|
-
} else if (message.includes("
|
|
3063
|
+
} else if (message.includes("CONNECTIVITY_ERROR")) {
|
|
3056
3064
|
return new ConnectivityError3(message);
|
|
3057
|
-
} else if (message.includes("
|
|
3065
|
+
} else if (message.includes("UNKNOWN_PROTOCOL_ERROR")) {
|
|
3058
3066
|
return new UnknownProtocolError3(message);
|
|
3059
3067
|
} else {
|
|
3060
3068
|
return typeof err === "string" ? new Error(err) : err;
|
|
@@ -3447,4 +3455,4 @@ export {
|
|
|
3447
3455
|
createLibDataChannelTransportFactory,
|
|
3448
3456
|
createTeleportProtocolFactory
|
|
3449
3457
|
};
|
|
3450
|
-
//# sourceMappingURL=chunk-
|
|
3458
|
+
//# sourceMappingURL=chunk-XRCMC23N.mjs.map
|