@dxos/network-manager 0.1.57 → 0.1.58-main.03af36b
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-UKMTAO4L.mjs → chunk-PSWNMALH.mjs} +195 -108
- package/dist/lib/browser/chunk-PSWNMALH.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 +155 -22
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node/index.cjs +192 -105
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +345 -125
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/types/src/swarm/connection.d.ts +3 -1
- package/dist/types/src/swarm/connection.d.ts.map +1 -1
- package/dist/types/src/swarm/peer.d.ts.map +1 -1
- package/dist/types/src/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/tests/tcp-transport.test.d.ts +2 -0
- package/dist/types/src/tests/tcp-transport.test.d.ts.map +1 -0
- package/dist/types/src/transport/simplepeer-transport-proxy.d.ts.map +1 -1
- package/dist/types/src/transport/simplepeer-transport.d.ts.map +1 -1
- package/dist/types/src/transport/tcp-transport.d.ts +23 -0
- package/dist/types/src/transport/tcp-transport.d.ts.map +1 -0
- package/dist/types/src/transport/transport.d.ts +2 -1
- package/dist/types/src/transport/transport.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/swarm/connection.ts +52 -26
- package/src/swarm/peer.ts +4 -1
- package/src/testing/test-builder.ts +5 -1
- package/src/tests/tcp-transport.test.ts +67 -0
- package/src/transport/simplepeer-transport-proxy.ts +28 -2
- package/src/transport/simplepeer-transport.ts +39 -2
- package/src/transport/tcp-transport.ts +107 -0
- package/src/transport/transport.ts +1 -0
- package/dist/lib/browser/chunk-UKMTAO4L.mjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -560,7 +560,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
560
560
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
561
561
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
562
562
|
}
|
|
563
|
-
var __dxlog_file = "/
|
|
563
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection.ts";
|
|
564
564
|
var STARTING_SIGNALLING_DELAY = 10;
|
|
565
565
|
var MAX_SIGNALLING_DELAY = 300;
|
|
566
566
|
var ConnectionState;
|
|
@@ -602,6 +602,8 @@ var ConnectionState;
|
|
|
602
602
|
*/
|
|
603
603
|
"CLOSED"
|
|
604
604
|
] = "CLOSED";
|
|
605
|
+
ConnectionState5["ABORTING"] = "ABORTING";
|
|
606
|
+
ConnectionState5["ABORTED"] = "ABORTED";
|
|
605
607
|
})(ConnectionState || (ConnectionState = {}));
|
|
606
608
|
var Connection = class {
|
|
607
609
|
constructor(topic, ownId, remoteId, sessionId, initiator, _signalMessaging, _protocol, _transportFactory, _callbacks) {
|
|
@@ -633,7 +635,7 @@ var Connection = class {
|
|
|
633
635
|
initiator: this.initiator
|
|
634
636
|
}, {
|
|
635
637
|
F: __dxlog_file,
|
|
636
|
-
L:
|
|
638
|
+
L: 123,
|
|
637
639
|
S: this,
|
|
638
640
|
C: (f, a) => f(...a)
|
|
639
641
|
});
|
|
@@ -653,7 +655,7 @@ var Connection = class {
|
|
|
653
655
|
async openConnection() {
|
|
654
656
|
(0, import_invariant.invariant)(this._state === ConnectionState.INITIAL, "Invalid state.", {
|
|
655
657
|
F: __dxlog_file,
|
|
656
|
-
L:
|
|
658
|
+
L: 148,
|
|
657
659
|
S: this,
|
|
658
660
|
A: [
|
|
659
661
|
"this._state === ConnectionState.INITIAL",
|
|
@@ -664,7 +666,7 @@ var Connection = class {
|
|
|
664
666
|
id: this._instanceId
|
|
665
667
|
}), {
|
|
666
668
|
F: __dxlog_file,
|
|
667
|
-
L:
|
|
669
|
+
L: 149,
|
|
668
670
|
S: this,
|
|
669
671
|
C: (f, a) => f(...a)
|
|
670
672
|
});
|
|
@@ -676,7 +678,7 @@ var Connection = class {
|
|
|
676
678
|
initiator: this.initiator
|
|
677
679
|
}, {
|
|
678
680
|
F: __dxlog_file,
|
|
679
|
-
L:
|
|
681
|
+
L: 150,
|
|
680
682
|
S: this,
|
|
681
683
|
C: (f, a) => f(...a)
|
|
682
684
|
});
|
|
@@ -687,15 +689,15 @@ var Connection = class {
|
|
|
687
689
|
this._protocol.stream.on("close", () => {
|
|
688
690
|
(0, import_log.log)("protocol stream closed", void 0, {
|
|
689
691
|
F: __dxlog_file,
|
|
690
|
-
L:
|
|
692
|
+
L: 167,
|
|
691
693
|
S: this,
|
|
692
694
|
C: (f, a) => f(...a)
|
|
693
695
|
});
|
|
694
|
-
this.close().catch((err) => this.errors.raise(err));
|
|
696
|
+
this.close(new import_errors.ProtocolError("protocol stream closed")).catch((err) => this.errors.raise(err));
|
|
695
697
|
});
|
|
696
698
|
(0, import_invariant.invariant)(!this._transport, void 0, {
|
|
697
699
|
F: __dxlog_file,
|
|
698
|
-
L:
|
|
700
|
+
L: 171,
|
|
699
701
|
S: this,
|
|
700
702
|
A: [
|
|
701
703
|
"!this._transport",
|
|
@@ -715,7 +717,7 @@ var Connection = class {
|
|
|
715
717
|
this._transport = void 0;
|
|
716
718
|
(0, import_log.log)("abort triggered by transport close", void 0, {
|
|
717
719
|
F: __dxlog_file,
|
|
718
|
-
L:
|
|
720
|
+
L: 185,
|
|
719
721
|
S: this,
|
|
720
722
|
C: (f, a) => f(...a)
|
|
721
723
|
});
|
|
@@ -726,21 +728,38 @@ var Connection = class {
|
|
|
726
728
|
err
|
|
727
729
|
}, {
|
|
728
730
|
F: __dxlog_file,
|
|
729
|
-
L:
|
|
731
|
+
L: 190,
|
|
730
732
|
S: this,
|
|
731
733
|
C: (f, a) => f(...a)
|
|
732
734
|
});
|
|
733
735
|
if (!this.closeReason) {
|
|
734
736
|
this.closeReason = err?.message;
|
|
735
737
|
}
|
|
736
|
-
if (err
|
|
737
|
-
(0, import_log.log)("aborting due to transport
|
|
738
|
+
if (err instanceof import_errors.ConnectionResetError) {
|
|
739
|
+
(0, import_log.log)("aborting due to transport ConnectionResetError", void 0, {
|
|
738
740
|
F: __dxlog_file,
|
|
739
|
-
L:
|
|
741
|
+
L: 197,
|
|
740
742
|
S: this,
|
|
741
743
|
C: (f, a) => f(...a)
|
|
742
744
|
});
|
|
743
745
|
this.abort().catch((err2) => this.errors.raise(err2));
|
|
746
|
+
} else if (err instanceof import_errors.ConnectivityError) {
|
|
747
|
+
(0, import_log.log)("aborting due to transport ConnectivityError", void 0, {
|
|
748
|
+
F: __dxlog_file,
|
|
749
|
+
L: 200,
|
|
750
|
+
S: this,
|
|
751
|
+
C: (f, a) => f(...a)
|
|
752
|
+
});
|
|
753
|
+
this.abort().catch((err2) => this.errors.raise(err2));
|
|
754
|
+
} else if (err instanceof import_errors.UnknownProtocolError) {
|
|
755
|
+
(0, import_log.log)("unsure what to do for UnknownProtocolError", {
|
|
756
|
+
err
|
|
757
|
+
}, {
|
|
758
|
+
F: __dxlog_file,
|
|
759
|
+
L: 203,
|
|
760
|
+
S: this,
|
|
761
|
+
C: (f, a) => f(...a)
|
|
762
|
+
});
|
|
744
763
|
}
|
|
745
764
|
if (this._state !== ConnectionState.CLOSED && this._state !== ConnectionState.CLOSING) {
|
|
746
765
|
this.errors.raise(err);
|
|
@@ -754,7 +773,7 @@ var Connection = class {
|
|
|
754
773
|
id: this._instanceId
|
|
755
774
|
}), {
|
|
756
775
|
F: __dxlog_file,
|
|
757
|
-
L:
|
|
776
|
+
L: 218,
|
|
758
777
|
S: this,
|
|
759
778
|
C: (f, a) => f(...a)
|
|
760
779
|
});
|
|
@@ -764,30 +783,30 @@ var Connection = class {
|
|
|
764
783
|
err
|
|
765
784
|
}, {
|
|
766
785
|
F: __dxlog_file,
|
|
767
|
-
L:
|
|
786
|
+
L: 224,
|
|
768
787
|
S: this,
|
|
769
788
|
C: (f, a) => f(...a)
|
|
770
789
|
});
|
|
771
|
-
if (
|
|
772
|
-
this.closeReason
|
|
773
|
-
}
|
|
774
|
-
if (this._state === ConnectionState.CLOSED) {
|
|
775
|
-
(0, import_log.log)("abort ignored: already closed", this.closeReason, {
|
|
790
|
+
if (this._state === ConnectionState.CLOSED || this._state === ConnectionState.ABORTED) {
|
|
791
|
+
(0, import_log.log)(`abort ignored: already ${this._state}`, this.closeReason, {
|
|
776
792
|
F: __dxlog_file,
|
|
777
|
-
L:
|
|
793
|
+
L: 226,
|
|
778
794
|
S: this,
|
|
779
795
|
C: (f, a) => f(...a)
|
|
780
796
|
});
|
|
781
797
|
return;
|
|
782
798
|
}
|
|
783
|
-
this._changeState(ConnectionState.
|
|
799
|
+
this._changeState(ConnectionState.ABORTING);
|
|
800
|
+
if (!this.closeReason) {
|
|
801
|
+
this.closeReason = err?.message;
|
|
802
|
+
}
|
|
784
803
|
await this._ctx.dispose();
|
|
785
804
|
try {
|
|
786
805
|
(0, import_log.log)("aborting protocol... ", {
|
|
787
806
|
proto: this._protocol
|
|
788
807
|
}, {
|
|
789
808
|
F: __dxlog_file,
|
|
790
|
-
L:
|
|
809
|
+
L: 239,
|
|
791
810
|
S: this,
|
|
792
811
|
C: (f, a) => f(...a)
|
|
793
812
|
});
|
|
@@ -795,7 +814,7 @@ var Connection = class {
|
|
|
795
814
|
} catch (err2) {
|
|
796
815
|
import_log.log.catch(err2, void 0, {
|
|
797
816
|
F: __dxlog_file,
|
|
798
|
-
L:
|
|
817
|
+
L: 242,
|
|
799
818
|
S: this,
|
|
800
819
|
C: (f, a) => f(...a)
|
|
801
820
|
});
|
|
@@ -805,56 +824,68 @@ var Connection = class {
|
|
|
805
824
|
} catch (err2) {
|
|
806
825
|
import_log.log.catch(err2, void 0, {
|
|
807
826
|
F: __dxlog_file,
|
|
808
|
-
L:
|
|
827
|
+
L: 249,
|
|
809
828
|
S: this,
|
|
810
829
|
C: (f, a) => f(...a)
|
|
811
830
|
});
|
|
812
831
|
}
|
|
813
|
-
|
|
814
|
-
|
|
832
|
+
try {
|
|
833
|
+
this._callbacks?.onClosed?.(err);
|
|
834
|
+
} catch (err2) {
|
|
835
|
+
import_log.log.catch(err2, void 0, {
|
|
836
|
+
F: __dxlog_file,
|
|
837
|
+
L: 255,
|
|
838
|
+
S: this,
|
|
839
|
+
C: (f, a) => f(...a)
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
this._changeState(ConnectionState.ABORTED);
|
|
815
843
|
}
|
|
816
844
|
async close(err) {
|
|
817
845
|
if (!this.closeReason) {
|
|
818
846
|
this.closeReason = err?.message;
|
|
819
847
|
}
|
|
820
|
-
if (this._state === ConnectionState.CLOSED) {
|
|
848
|
+
if (this._state === ConnectionState.CLOSED || this._state === ConnectionState.ABORTING || this._state === ConnectionState.ABORTED) {
|
|
821
849
|
return;
|
|
822
850
|
}
|
|
851
|
+
const lastState = this._state;
|
|
823
852
|
this._changeState(ConnectionState.CLOSING);
|
|
824
853
|
await this._ctx.dispose();
|
|
825
854
|
(0, import_log.log)("closing...", {
|
|
826
855
|
peerId: this.ownId
|
|
827
856
|
}, {
|
|
828
857
|
F: __dxlog_file,
|
|
829
|
-
L:
|
|
858
|
+
L: 277,
|
|
830
859
|
S: this,
|
|
831
860
|
C: (f, a) => f(...a)
|
|
832
861
|
});
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
862
|
+
if (lastState === ConnectionState.CONNECTED) {
|
|
863
|
+
try {
|
|
864
|
+
await this._protocol.close();
|
|
865
|
+
} catch (err2) {
|
|
866
|
+
import_log.log.catch(err2, void 0, {
|
|
867
|
+
F: __dxlog_file,
|
|
868
|
+
L: 284,
|
|
869
|
+
S: this,
|
|
870
|
+
C: (f, a) => f(...a)
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
try {
|
|
874
|
+
await this._transport?.destroy();
|
|
875
|
+
} catch (err2) {
|
|
876
|
+
import_log.log.catch(err2, void 0, {
|
|
877
|
+
F: __dxlog_file,
|
|
878
|
+
L: 291,
|
|
879
|
+
S: this,
|
|
880
|
+
C: (f, a) => f(...a)
|
|
881
|
+
});
|
|
882
|
+
}
|
|
852
883
|
}
|
|
853
884
|
(0, import_log.log)("closed", {
|
|
854
885
|
peerId: this.ownId
|
|
855
886
|
}, {
|
|
856
887
|
F: __dxlog_file,
|
|
857
|
-
L:
|
|
888
|
+
L: 295,
|
|
858
889
|
S: this,
|
|
859
890
|
C: (f, a) => f(...a)
|
|
860
891
|
});
|
|
@@ -897,7 +928,7 @@ var Connection = class {
|
|
|
897
928
|
err
|
|
898
929
|
}, {
|
|
899
930
|
F: __dxlog_file,
|
|
900
|
-
L:
|
|
931
|
+
L: 332,
|
|
901
932
|
S: this,
|
|
902
933
|
C: (f, a) => f(...a)
|
|
903
934
|
});
|
|
@@ -910,7 +941,7 @@ var Connection = class {
|
|
|
910
941
|
async signal(msg) {
|
|
911
942
|
(0, import_invariant.invariant)(msg.sessionId, void 0, {
|
|
912
943
|
F: __dxlog_file,
|
|
913
|
-
L:
|
|
944
|
+
L: 341,
|
|
914
945
|
S: this,
|
|
915
946
|
A: [
|
|
916
947
|
"msg.sessionId",
|
|
@@ -920,7 +951,7 @@ var Connection = class {
|
|
|
920
951
|
if (!msg.sessionId.equals(this.sessionId)) {
|
|
921
952
|
(0, import_log.log)("dropping signal for incorrect session id", void 0, {
|
|
922
953
|
F: __dxlog_file,
|
|
923
|
-
L:
|
|
954
|
+
L: 343,
|
|
924
955
|
S: this,
|
|
925
956
|
C: (f, a) => f(...a)
|
|
926
957
|
});
|
|
@@ -928,7 +959,7 @@ var Connection = class {
|
|
|
928
959
|
}
|
|
929
960
|
(0, import_invariant.invariant)(msg.data.signal || msg.data.signalBatch, void 0, {
|
|
930
961
|
F: __dxlog_file,
|
|
931
|
-
L:
|
|
962
|
+
L: 346,
|
|
932
963
|
S: this,
|
|
933
964
|
A: [
|
|
934
965
|
"msg.data.signal || msg.data.signalBatch",
|
|
@@ -937,7 +968,7 @@ var Connection = class {
|
|
|
937
968
|
});
|
|
938
969
|
(0, import_invariant.invariant)(msg.author?.equals(this.remoteId), void 0, {
|
|
939
970
|
F: __dxlog_file,
|
|
940
|
-
L:
|
|
971
|
+
L: 347,
|
|
941
972
|
S: this,
|
|
942
973
|
A: [
|
|
943
974
|
"msg.author?.equals(this.remoteId)",
|
|
@@ -946,7 +977,7 @@ var Connection = class {
|
|
|
946
977
|
});
|
|
947
978
|
(0, import_invariant.invariant)(msg.recipient?.equals(this.ownId), void 0, {
|
|
948
979
|
F: __dxlog_file,
|
|
949
|
-
L:
|
|
980
|
+
L: 348,
|
|
950
981
|
S: this,
|
|
951
982
|
A: [
|
|
952
983
|
"msg.recipient?.equals(this.ownId)",
|
|
@@ -970,7 +1001,7 @@ var Connection = class {
|
|
|
970
1001
|
msg: msg.data
|
|
971
1002
|
}, {
|
|
972
1003
|
F: __dxlog_file,
|
|
973
|
-
L:
|
|
1004
|
+
L: 357,
|
|
974
1005
|
S: this,
|
|
975
1006
|
C: (f, a) => f(...a)
|
|
976
1007
|
});
|
|
@@ -978,7 +1009,7 @@ var Connection = class {
|
|
|
978
1009
|
} else {
|
|
979
1010
|
(0, import_invariant.invariant)(this._transport, "Connection not ready to accept signals.", {
|
|
980
1011
|
F: __dxlog_file,
|
|
981
|
-
L:
|
|
1012
|
+
L: 360,
|
|
982
1013
|
S: this,
|
|
983
1014
|
A: [
|
|
984
1015
|
"this._transport",
|
|
@@ -991,7 +1022,7 @@ var Connection = class {
|
|
|
991
1022
|
msg: msg.data
|
|
992
1023
|
}, {
|
|
993
1024
|
F: __dxlog_file,
|
|
994
|
-
L:
|
|
1025
|
+
L: 361,
|
|
995
1026
|
S: this,
|
|
996
1027
|
C: (f, a) => f(...a)
|
|
997
1028
|
});
|
|
@@ -1005,17 +1036,17 @@ var Connection = class {
|
|
|
1005
1036
|
_changeState(state) {
|
|
1006
1037
|
(0, import_log.log)("stateChanged", {
|
|
1007
1038
|
from: this._state,
|
|
1008
|
-
|
|
1039
|
+
to: state,
|
|
1009
1040
|
peerId: this.ownId
|
|
1010
1041
|
}, {
|
|
1011
1042
|
F: __dxlog_file,
|
|
1012
|
-
L:
|
|
1043
|
+
L: 372,
|
|
1013
1044
|
S: this,
|
|
1014
1045
|
C: (f, a) => f(...a)
|
|
1015
1046
|
});
|
|
1016
1047
|
(0, import_invariant.invariant)(state !== this._state, "Already in this state.", {
|
|
1017
1048
|
F: __dxlog_file,
|
|
1018
|
-
L:
|
|
1049
|
+
L: 373,
|
|
1019
1050
|
S: this,
|
|
1020
1051
|
A: [
|
|
1021
1052
|
"state !== this._state",
|
|
@@ -1050,7 +1081,7 @@ var import_keys2 = require("@dxos/keys");
|
|
|
1050
1081
|
var import_log2 = require("@dxos/log");
|
|
1051
1082
|
var import_protocols2 = require("@dxos/protocols");
|
|
1052
1083
|
var import_util = require("@dxos/util");
|
|
1053
|
-
var __dxlog_file2 = "/
|
|
1084
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/signal/swarm-messenger.ts";
|
|
1054
1085
|
var SwarmMessage = import_protocols2.schema.getCodecForType("dxos.mesh.swarm.SwarmMessage");
|
|
1055
1086
|
var SwarmMessenger = class {
|
|
1056
1087
|
constructor({ sendMessage, onSignal, onOffer, topic }) {
|
|
@@ -1292,7 +1323,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
1292
1323
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1293
1324
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1294
1325
|
}
|
|
1295
|
-
var __dxlog_file3 = "/
|
|
1326
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/peer.ts";
|
|
1296
1327
|
var ConnectionDisplacedError = class extends import_errors2.SystemError {
|
|
1297
1328
|
constructor() {
|
|
1298
1329
|
super("Connection displaced by remote initiator.");
|
|
@@ -1471,6 +1502,9 @@ var Peer = class {
|
|
|
1471
1502
|
S: this,
|
|
1472
1503
|
C: (f, a) => f(...a)
|
|
1473
1504
|
});
|
|
1505
|
+
if (err instanceof import_errors2.TimeoutError) {
|
|
1506
|
+
await connection.abort(err);
|
|
1507
|
+
}
|
|
1474
1508
|
await this.closeConnection(err);
|
|
1475
1509
|
throw err;
|
|
1476
1510
|
} finally {
|
|
@@ -1490,13 +1524,13 @@ var Peer = class {
|
|
|
1490
1524
|
sessionId
|
|
1491
1525
|
}, {
|
|
1492
1526
|
F: __dxlog_file3,
|
|
1493
|
-
L:
|
|
1527
|
+
L: 213,
|
|
1494
1528
|
S: this,
|
|
1495
1529
|
C: (f, a) => f(...a)
|
|
1496
1530
|
});
|
|
1497
1531
|
(0, import_invariant3.invariant)(!this.connection, "Already connected.", {
|
|
1498
1532
|
F: __dxlog_file3,
|
|
1499
|
-
L:
|
|
1533
|
+
L: 220,
|
|
1500
1534
|
S: this,
|
|
1501
1535
|
A: [
|
|
1502
1536
|
"!this.connection",
|
|
@@ -1532,7 +1566,7 @@ var Peer = class {
|
|
|
1532
1566
|
initiator
|
|
1533
1567
|
}, {
|
|
1534
1568
|
F: __dxlog_file3,
|
|
1535
|
-
L:
|
|
1569
|
+
L: 239,
|
|
1536
1570
|
S: this,
|
|
1537
1571
|
C: (f, a) => f(...a)
|
|
1538
1572
|
});
|
|
@@ -1545,14 +1579,14 @@ var Peer = class {
|
|
|
1545
1579
|
initiator
|
|
1546
1580
|
}, {
|
|
1547
1581
|
F: __dxlog_file3,
|
|
1548
|
-
L:
|
|
1582
|
+
L: 248,
|
|
1549
1583
|
S: this,
|
|
1550
1584
|
C: (f, a) => f(...a)
|
|
1551
1585
|
});
|
|
1552
1586
|
this._connectionLimiter.doneConnecting(sessionId);
|
|
1553
1587
|
(0, import_invariant3.invariant)(this.connection === connection, "Connection mismatch (race condition).", {
|
|
1554
1588
|
F: __dxlog_file3,
|
|
1555
|
-
L:
|
|
1589
|
+
L: 253,
|
|
1556
1590
|
S: this,
|
|
1557
1591
|
A: [
|
|
1558
1592
|
"this.connection === connection",
|
|
@@ -1567,7 +1601,7 @@ var Peer = class {
|
|
|
1567
1601
|
initiator
|
|
1568
1602
|
}, {
|
|
1569
1603
|
F: __dxlog_file3,
|
|
1570
|
-
L:
|
|
1604
|
+
L: 255,
|
|
1571
1605
|
S: this,
|
|
1572
1606
|
C: (f, a) => f(...a)
|
|
1573
1607
|
});
|
|
@@ -1602,7 +1636,7 @@ var Peer = class {
|
|
|
1602
1636
|
err
|
|
1603
1637
|
}, {
|
|
1604
1638
|
F: __dxlog_file3,
|
|
1605
|
-
L:
|
|
1639
|
+
L: 295,
|
|
1606
1640
|
S: this,
|
|
1607
1641
|
C: (f, a) => f(...a)
|
|
1608
1642
|
});
|
|
@@ -1615,7 +1649,7 @@ var Peer = class {
|
|
|
1615
1649
|
err
|
|
1616
1650
|
}, {
|
|
1617
1651
|
F: __dxlog_file3,
|
|
1618
|
-
L:
|
|
1652
|
+
L: 296,
|
|
1619
1653
|
S: this,
|
|
1620
1654
|
C: (f, a) => f(...a)
|
|
1621
1655
|
});
|
|
@@ -1634,7 +1668,7 @@ var Peer = class {
|
|
|
1634
1668
|
sessionId: connection.sessionId
|
|
1635
1669
|
}, {
|
|
1636
1670
|
F: __dxlog_file3,
|
|
1637
|
-
L:
|
|
1671
|
+
L: 321,
|
|
1638
1672
|
S: this,
|
|
1639
1673
|
C: (f, a) => f(...a)
|
|
1640
1674
|
});
|
|
@@ -1644,7 +1678,7 @@ var Peer = class {
|
|
|
1644
1678
|
sessionId: connection.sessionId
|
|
1645
1679
|
}, {
|
|
1646
1680
|
F: __dxlog_file3,
|
|
1647
|
-
L:
|
|
1681
|
+
L: 327,
|
|
1648
1682
|
S: this,
|
|
1649
1683
|
C: (f, a) => f(...a)
|
|
1650
1684
|
});
|
|
@@ -1655,7 +1689,7 @@ var Peer = class {
|
|
|
1655
1689
|
message
|
|
1656
1690
|
}, {
|
|
1657
1691
|
F: __dxlog_file3,
|
|
1658
|
-
L:
|
|
1692
|
+
L: 332,
|
|
1659
1693
|
S: this,
|
|
1660
1694
|
C: (f, a) => f(...a)
|
|
1661
1695
|
});
|
|
@@ -1670,7 +1704,7 @@ var Peer = class {
|
|
|
1670
1704
|
topic: this.topic
|
|
1671
1705
|
}, {
|
|
1672
1706
|
F: __dxlog_file3,
|
|
1673
|
-
L:
|
|
1707
|
+
L: 342,
|
|
1674
1708
|
S: this,
|
|
1675
1709
|
C: (f, a) => f(...a)
|
|
1676
1710
|
});
|
|
@@ -1704,7 +1738,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
1704
1738
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1705
1739
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1706
1740
|
}
|
|
1707
|
-
var __dxlog_file4 = "/
|
|
1741
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/swarm.ts";
|
|
1708
1742
|
var INITIATION_DELAY = 100;
|
|
1709
1743
|
var getClassName = (obj) => Object.getPrototypeOf(obj).constructor.name;
|
|
1710
1744
|
var Swarm = class {
|
|
@@ -2178,7 +2212,7 @@ var import_async4 = require("@dxos/async");
|
|
|
2178
2212
|
var import_keys5 = require("@dxos/keys");
|
|
2179
2213
|
var import_log5 = require("@dxos/log");
|
|
2180
2214
|
var import_util3 = require("@dxos/util");
|
|
2181
|
-
var __dxlog_file5 = "/
|
|
2215
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/swarm-mapper.ts";
|
|
2182
2216
|
var SwarmMapper = class {
|
|
2183
2217
|
get peers() {
|
|
2184
2218
|
return Array.from(this._peers.values());
|
|
@@ -2251,7 +2285,7 @@ var import_invariant5 = require("@dxos/invariant");
|
|
|
2251
2285
|
var import_keys6 = require("@dxos/keys");
|
|
2252
2286
|
var import_log6 = require("@dxos/log");
|
|
2253
2287
|
var import_util4 = require("@dxos/util");
|
|
2254
|
-
var __dxlog_file6 = "/
|
|
2288
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection-limiter.ts";
|
|
2255
2289
|
var MAX_CONCURRENT_INITIATING_CONNECTIONS = 10;
|
|
2256
2290
|
var ConnectionLimiter = class {
|
|
2257
2291
|
constructor({ maxConcurrentInitConnections = MAX_CONCURRENT_INITIATING_CONNECTIONS } = {}) {
|
|
@@ -2400,7 +2434,7 @@ var import_messaging = require("@dxos/messaging");
|
|
|
2400
2434
|
var import_protocols4 = require("@dxos/protocols");
|
|
2401
2435
|
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
2402
2436
|
var import_util6 = require("@dxos/util");
|
|
2403
|
-
var __dxlog_file7 = "/
|
|
2437
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/network-manager.ts";
|
|
2404
2438
|
var NetworkManager = class {
|
|
2405
2439
|
constructor({ transportFactory, signalManager, log: log1 }) {
|
|
2406
2440
|
/**
|
|
@@ -2636,7 +2670,7 @@ var NetworkManager = class {
|
|
|
2636
2670
|
|
|
2637
2671
|
// packages/core/mesh/network-manager/src/topology/fully-connected-topology.ts
|
|
2638
2672
|
var import_invariant7 = require("@dxos/invariant");
|
|
2639
|
-
var __dxlog_file8 = "/
|
|
2673
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/fully-connected-topology.ts";
|
|
2640
2674
|
var FullyConnectedTopology = class {
|
|
2641
2675
|
toString() {
|
|
2642
2676
|
return "FullyConnectedTopology";
|
|
@@ -2679,7 +2713,7 @@ var FullyConnectedTopology = class {
|
|
|
2679
2713
|
var import_xor_distance = __toESM(require("xor-distance"));
|
|
2680
2714
|
var import_invariant8 = require("@dxos/invariant");
|
|
2681
2715
|
var import_log8 = require("@dxos/log");
|
|
2682
|
-
var __dxlog_file9 = "/
|
|
2716
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/mmst-topology.ts";
|
|
2683
2717
|
var MMSTTopology = class {
|
|
2684
2718
|
constructor({ originateConnections = 2, maxPeers = 4, sampleSize = 10 } = {}) {
|
|
2685
2719
|
this._sampleCollected = false;
|
|
@@ -2788,7 +2822,7 @@ var sortByXorDistance = (keys, reference) => keys.sort((a, b) => import_xor_dist
|
|
|
2788
2822
|
// packages/core/mesh/network-manager/src/topology/star-topology.ts
|
|
2789
2823
|
var import_invariant9 = require("@dxos/invariant");
|
|
2790
2824
|
var import_log9 = require("@dxos/log");
|
|
2791
|
-
var __dxlog_file10 = "/
|
|
2825
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/star-topology.ts";
|
|
2792
2826
|
var StarTopology = class {
|
|
2793
2827
|
// prettier-ignore
|
|
2794
2828
|
constructor(_centralPeer) {
|
|
@@ -2900,7 +2934,7 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
2900
2934
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2901
2935
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2902
2936
|
}
|
|
2903
|
-
var __dxlog_file11 = "/
|
|
2937
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/memory-transport.ts";
|
|
2904
2938
|
var MEMORY_TRANSPORT_DELAY = 1;
|
|
2905
2939
|
var createStreamDelay = (delay) => {
|
|
2906
2940
|
return new import_node_stream.Transform({
|
|
@@ -3075,6 +3109,7 @@ var TransportKind;
|
|
|
3075
3109
|
TransportKind2["LIBDATACHANNEL"] = "LIBDATACHANNEL";
|
|
3076
3110
|
TransportKind2["SIMPLE_PEER_PROXY"] = "SIMPLE_PEER_PROXY";
|
|
3077
3111
|
TransportKind2["MEMORY"] = "MEMORY";
|
|
3112
|
+
TransportKind2["TCP"] = "TCP";
|
|
3078
3113
|
})(TransportKind || (TransportKind = {}));
|
|
3079
3114
|
|
|
3080
3115
|
// packages/core/mesh/network-manager/src/transport/simplepeer-transport.ts
|
|
@@ -3082,6 +3117,7 @@ var import_simple_peer = __toESM(require("simple-peer"));
|
|
|
3082
3117
|
var import_tiny_invariant = __toESM(require("tiny-invariant"));
|
|
3083
3118
|
var import_async9 = require("@dxos/async");
|
|
3084
3119
|
var import_debug5 = require("@dxos/debug");
|
|
3120
|
+
var import_errors4 = require("@dxos/errors");
|
|
3085
3121
|
var import_keys10 = require("@dxos/keys");
|
|
3086
3122
|
var import_log11 = require("@dxos/log");
|
|
3087
3123
|
var import_protocols5 = require("@dxos/protocols");
|
|
@@ -3094,7 +3130,7 @@ try {
|
|
|
3094
3130
|
}
|
|
3095
3131
|
|
|
3096
3132
|
// packages/core/mesh/network-manager/src/transport/simplepeer-transport.ts
|
|
3097
|
-
var __dxlog_file12 = "/
|
|
3133
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport.ts";
|
|
3098
3134
|
var SimplePeerTransport = class {
|
|
3099
3135
|
constructor(params) {
|
|
3100
3136
|
this.params = params;
|
|
@@ -3107,13 +3143,13 @@ var SimplePeerTransport = class {
|
|
|
3107
3143
|
id: this._instanceId
|
|
3108
3144
|
}), {
|
|
3109
3145
|
F: __dxlog_file12,
|
|
3110
|
-
L:
|
|
3146
|
+
L: 41,
|
|
3111
3147
|
S: this,
|
|
3112
3148
|
C: (f, a) => f(...a)
|
|
3113
3149
|
});
|
|
3114
3150
|
(0, import_log11.log)("created connection", params, {
|
|
3115
3151
|
F: __dxlog_file12,
|
|
3116
|
-
L:
|
|
3152
|
+
L: 42,
|
|
3117
3153
|
S: this,
|
|
3118
3154
|
C: (f, a) => f(...a)
|
|
3119
3155
|
});
|
|
@@ -3126,7 +3162,7 @@ var SimplePeerTransport = class {
|
|
|
3126
3162
|
this._peer.on("signal", async (data) => {
|
|
3127
3163
|
(0, import_log11.log)("signal", data, {
|
|
3128
3164
|
F: __dxlog_file12,
|
|
3129
|
-
L:
|
|
3165
|
+
L: 51,
|
|
3130
3166
|
S: this,
|
|
3131
3167
|
C: (f, a) => f(...a)
|
|
3132
3168
|
});
|
|
@@ -3139,7 +3175,7 @@ var SimplePeerTransport = class {
|
|
|
3139
3175
|
this._peer.on("connect", () => {
|
|
3140
3176
|
(0, import_log11.log)("connected", void 0, {
|
|
3141
3177
|
F: __dxlog_file12,
|
|
3142
|
-
L:
|
|
3178
|
+
L: 56,
|
|
3143
3179
|
S: this,
|
|
3144
3180
|
C: (f, a) => f(...a)
|
|
3145
3181
|
});
|
|
@@ -3149,7 +3185,7 @@ var SimplePeerTransport = class {
|
|
|
3149
3185
|
this._peer.on("close", async () => {
|
|
3150
3186
|
(0, import_log11.log)("closed", void 0, {
|
|
3151
3187
|
F: __dxlog_file12,
|
|
3152
|
-
L:
|
|
3188
|
+
L: 62,
|
|
3153
3189
|
S: this,
|
|
3154
3190
|
C: (f, a) => f(...a)
|
|
3155
3191
|
});
|
|
@@ -3157,7 +3193,35 @@ var SimplePeerTransport = class {
|
|
|
3157
3193
|
this.closed.emit();
|
|
3158
3194
|
});
|
|
3159
3195
|
this._peer.on("error", async (err) => {
|
|
3160
|
-
|
|
3196
|
+
if (typeof RTCError !== "undefined" && err instanceof RTCError) {
|
|
3197
|
+
if (err.errorDetail === "sctp-failure") {
|
|
3198
|
+
this.errors.raise(new import_errors4.ConnectionResetError("sctp-failure from RTCError", err));
|
|
3199
|
+
} else {
|
|
3200
|
+
this.errors.raise(new import_errors4.UnknownProtocolError("unknown RTCError", err));
|
|
3201
|
+
}
|
|
3202
|
+
} else if (err.name === "InvalidStateError") {
|
|
3203
|
+
this.errors.raise(new import_errors4.ConnectionResetError("safari WebRTC error", err));
|
|
3204
|
+
} else if ("code" in err) {
|
|
3205
|
+
switch (err.code) {
|
|
3206
|
+
case "ERR_WEBRTC_SUPPORT":
|
|
3207
|
+
this.errors.raise(new import_errors4.ProtocolError("WebRTC not supported", err));
|
|
3208
|
+
case "ERR_ICE_CONNECTION_FAILURE":
|
|
3209
|
+
case "ERR_DATA_CHANNEL":
|
|
3210
|
+
case "ERR_CONNECTION_FAILURE":
|
|
3211
|
+
case "ERR_SIGNALING":
|
|
3212
|
+
this.errors.raise(new import_errors4.ConnectivityError("unknown communication failure", err));
|
|
3213
|
+
case "ERR_CREATE_OFFER":
|
|
3214
|
+
case "ERR_CREATE_ANSWER":
|
|
3215
|
+
case "ERR_SET_LOCAL_DESCRIPTION":
|
|
3216
|
+
case "ERR_SET_REMOTE_DESCRIPTION":
|
|
3217
|
+
case "ERR_ADD_ICE_CANDIDATE":
|
|
3218
|
+
this.errors.raise(new import_errors4.UnknownProtocolError("unknown simple-peer library failure", err));
|
|
3219
|
+
default:
|
|
3220
|
+
this.errors.raise(new Error("unknown simple-peer error"));
|
|
3221
|
+
}
|
|
3222
|
+
} else {
|
|
3223
|
+
this.errors.raise(err);
|
|
3224
|
+
}
|
|
3161
3225
|
try {
|
|
3162
3226
|
if (typeof this._peer?._pc.getStats === "function") {
|
|
3163
3227
|
this._peer._pc.getStats().then((stats) => {
|
|
@@ -3166,13 +3230,19 @@ var SimplePeerTransport = class {
|
|
|
3166
3230
|
stats
|
|
3167
3231
|
}, {
|
|
3168
3232
|
F: __dxlog_file12,
|
|
3169
|
-
L:
|
|
3233
|
+
L: 107,
|
|
3170
3234
|
S: this,
|
|
3171
3235
|
C: (f, a) => f(...a)
|
|
3172
3236
|
});
|
|
3173
3237
|
});
|
|
3174
3238
|
}
|
|
3175
|
-
} catch {
|
|
3239
|
+
} catch (err2) {
|
|
3240
|
+
import_log11.log.catch(err2, void 0, {
|
|
3241
|
+
F: __dxlog_file12,
|
|
3242
|
+
L: 114,
|
|
3243
|
+
S: this,
|
|
3244
|
+
C: (f, a) => f(...a)
|
|
3245
|
+
});
|
|
3176
3246
|
}
|
|
3177
3247
|
await this.destroy();
|
|
3178
3248
|
});
|
|
@@ -3180,7 +3250,7 @@ var SimplePeerTransport = class {
|
|
|
3180
3250
|
id: this._instanceId
|
|
3181
3251
|
}), {
|
|
3182
3252
|
F: __dxlog_file12,
|
|
3183
|
-
L:
|
|
3253
|
+
L: 119,
|
|
3184
3254
|
S: this,
|
|
3185
3255
|
C: (f, a) => f(...a)
|
|
3186
3256
|
});
|
|
@@ -3188,7 +3258,7 @@ var SimplePeerTransport = class {
|
|
|
3188
3258
|
async destroy() {
|
|
3189
3259
|
(0, import_log11.log)("closing...", void 0, {
|
|
3190
3260
|
F: __dxlog_file12,
|
|
3191
|
-
L:
|
|
3261
|
+
L: 123,
|
|
3192
3262
|
S: this,
|
|
3193
3263
|
C: (f, a) => f(...a)
|
|
3194
3264
|
});
|
|
@@ -3198,7 +3268,7 @@ var SimplePeerTransport = class {
|
|
|
3198
3268
|
this.closed.emit();
|
|
3199
3269
|
(0, import_log11.log)("closed", void 0, {
|
|
3200
3270
|
F: __dxlog_file12,
|
|
3201
|
-
L:
|
|
3271
|
+
L: 128,
|
|
3202
3272
|
S: this,
|
|
3203
3273
|
C: (f, a) => f(...a)
|
|
3204
3274
|
});
|
|
@@ -3229,7 +3299,7 @@ var import_keys11 = require("@dxos/keys");
|
|
|
3229
3299
|
var import_log12 = require("@dxos/log");
|
|
3230
3300
|
var import_bridge = require("@dxos/protocols/proto/dxos/mesh/bridge");
|
|
3231
3301
|
var import_util8 = require("@dxos/util");
|
|
3232
|
-
var __dxlog_file13 = "/
|
|
3302
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport-service.ts";
|
|
3233
3303
|
var SimplePeerTransportService = class {
|
|
3234
3304
|
// prettier-ignore
|
|
3235
3305
|
constructor(_webrtcConfig) {
|
|
@@ -3356,12 +3426,13 @@ var import_node_stream3 = require("node:stream");
|
|
|
3356
3426
|
var import_async10 = require("@dxos/async");
|
|
3357
3427
|
var import_context6 = require("@dxos/context");
|
|
3358
3428
|
var import_debug6 = require("@dxos/debug");
|
|
3429
|
+
var import_errors5 = require("@dxos/errors");
|
|
3359
3430
|
var import_invariant12 = require("@dxos/invariant");
|
|
3360
3431
|
var import_keys12 = require("@dxos/keys");
|
|
3361
3432
|
var import_log13 = require("@dxos/log");
|
|
3362
3433
|
var import_bridge2 = require("@dxos/protocols/proto/dxos/mesh/bridge");
|
|
3363
3434
|
var import_util9 = require("@dxos/util");
|
|
3364
|
-
var __dxlog_file14 = "/
|
|
3435
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport-proxy.ts";
|
|
3365
3436
|
var SimplePeerTransportProxy = class {
|
|
3366
3437
|
// prettier-ignore
|
|
3367
3438
|
constructor(_params) {
|
|
@@ -3380,7 +3451,7 @@ var SimplePeerTransportProxy = class {
|
|
|
3380
3451
|
this._serviceStream.subscribe(async (event) => {
|
|
3381
3452
|
(0, import_log13.log)("SimplePeerTransportProxy: event", event, {
|
|
3382
3453
|
F: __dxlog_file14,
|
|
3383
|
-
L:
|
|
3454
|
+
L: 58,
|
|
3384
3455
|
S: this,
|
|
3385
3456
|
C: (f, a) => f(...a)
|
|
3386
3457
|
});
|
|
@@ -3400,7 +3471,7 @@ var SimplePeerTransportProxy = class {
|
|
|
3400
3471
|
}).then(() => callback(), (err) => {
|
|
3401
3472
|
import_log13.log.catch(err, void 0, {
|
|
3402
3473
|
F: __dxlog_file14,
|
|
3403
|
-
L:
|
|
3474
|
+
L: 76,
|
|
3404
3475
|
S: this,
|
|
3405
3476
|
C: (f, a) => f(...a)
|
|
3406
3477
|
});
|
|
@@ -3409,14 +3480,14 @@ var SimplePeerTransportProxy = class {
|
|
|
3409
3480
|
}));
|
|
3410
3481
|
}, (error) => import_log13.log.catch(error, void 0, {
|
|
3411
3482
|
F: __dxlog_file14,
|
|
3412
|
-
L:
|
|
3483
|
+
L: 82,
|
|
3413
3484
|
S: this,
|
|
3414
3485
|
C: (f, a) => f(...a)
|
|
3415
3486
|
}));
|
|
3416
3487
|
}
|
|
3417
3488
|
async _handleConnection(connectionEvent) {
|
|
3418
3489
|
if (connectionEvent.error) {
|
|
3419
|
-
this.errors.raise(
|
|
3490
|
+
this.errors.raise(decodeError(connectionEvent.error));
|
|
3420
3491
|
}
|
|
3421
3492
|
switch (connectionEvent.state) {
|
|
3422
3493
|
case import_bridge2.ConnectionState.CONNECTED: {
|
|
@@ -3439,7 +3510,7 @@ var SimplePeerTransportProxy = class {
|
|
|
3439
3510
|
this._params.bridgeService.sendSignal({
|
|
3440
3511
|
proxyId: this._proxyId,
|
|
3441
3512
|
signal
|
|
3442
|
-
}).catch((err) => this.errors.raise(err));
|
|
3513
|
+
}).catch((err) => this.errors.raise(decodeError(err)));
|
|
3443
3514
|
}
|
|
3444
3515
|
// TODO(burdon): Move open from constructor.
|
|
3445
3516
|
async destroy() {
|
|
@@ -3455,7 +3526,7 @@ var SimplePeerTransportProxy = class {
|
|
|
3455
3526
|
} catch (err) {
|
|
3456
3527
|
import_log13.log.catch(err, void 0, {
|
|
3457
3528
|
F: __dxlog_file14,
|
|
3458
|
-
L:
|
|
3529
|
+
L: 133,
|
|
3459
3530
|
S: this,
|
|
3460
3531
|
C: (f, a) => f(...a)
|
|
3461
3532
|
});
|
|
@@ -3491,7 +3562,7 @@ var SimplePeerTransportProxyFactory = class {
|
|
|
3491
3562
|
createTransport(options) {
|
|
3492
3563
|
(0, import_invariant12.invariant)(this._bridgeService, "SimplePeerTransportProxyFactory is not ready to open connections", {
|
|
3493
3564
|
F: __dxlog_file14,
|
|
3494
|
-
L:
|
|
3565
|
+
L: 170,
|
|
3495
3566
|
S: this,
|
|
3496
3567
|
A: [
|
|
3497
3568
|
"this._bridgeService",
|
|
@@ -3507,6 +3578,22 @@ var SimplePeerTransportProxyFactory = class {
|
|
|
3507
3578
|
return transport;
|
|
3508
3579
|
}
|
|
3509
3580
|
};
|
|
3581
|
+
var decodeError = (err) => {
|
|
3582
|
+
const message = typeof err === "string" ? err : err.message;
|
|
3583
|
+
if (message.includes("ConnectionResetError")) {
|
|
3584
|
+
return new import_errors5.ConnectionResetError(message);
|
|
3585
|
+
} else if (message.includes("TimeoutError")) {
|
|
3586
|
+
return new import_errors5.TimeoutError(message);
|
|
3587
|
+
} else if (message.includes("ProtocolError")) {
|
|
3588
|
+
return new import_errors5.ProtocolError(message);
|
|
3589
|
+
} else if (message.includes("ConnectivityError")) {
|
|
3590
|
+
return new import_errors5.ConnectivityError(message);
|
|
3591
|
+
} else if (message.includes("UnknownProtocolError")) {
|
|
3592
|
+
return new import_errors5.UnknownProtocolError(message);
|
|
3593
|
+
} else {
|
|
3594
|
+
return typeof err === "string" ? new Error(err) : err;
|
|
3595
|
+
}
|
|
3596
|
+
};
|
|
3510
3597
|
|
|
3511
3598
|
// packages/core/mesh/network-manager/src/transport/index.ts
|
|
3512
3599
|
init_datachannel();
|
|
@@ -3526,7 +3613,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
3526
3613
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3527
3614
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3528
3615
|
}
|
|
3529
|
-
var __dxlog_file15 = "/
|
|
3616
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/libdatachannel-transport.ts";
|
|
3530
3617
|
var DATACHANNEL_LABEL = "dxos.mesh.transport";
|
|
3531
3618
|
var MAX_BUFFERED_AMOUNT = 64 * 1024;
|
|
3532
3619
|
var MAX_MESSAGE_SIZE = 64 * 1024;
|