@dxos/network-manager 0.3.0 → 0.3.1-main.0fddbd4
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-LN6AHVN6.mjs → chunk-54UAGQNZ.mjs} +197 -120
- package/dist/lib/browser/chunk-54UAGQNZ.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 -3
- package/dist/lib/node/index.cjs +188 -111
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +188 -111
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/swarm/connection.d.ts +1 -0
- 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/swarm/swarm.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/swarm/connection.ts +26 -4
- package/src/swarm/peer.ts +47 -11
- package/src/swarm/swarm.ts +10 -7
- package/dist/lib/browser/chunk-LN6AHVN6.mjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -561,8 +561,9 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
561
561
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
562
562
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
563
563
|
}
|
|
564
|
-
var __dxlog_file = "/
|
|
564
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection.ts";
|
|
565
565
|
var STARTING_SIGNALLING_DELAY = 10;
|
|
566
|
+
var TRANSPORT_CONNECTION_TIMEOUT = 1e4;
|
|
566
567
|
var MAX_SIGNALLING_DELAY = 300;
|
|
567
568
|
var ConnectionState;
|
|
568
569
|
(function(ConnectionState5) {
|
|
@@ -618,6 +619,7 @@ var Connection = class {
|
|
|
618
619
|
this._transportFactory = _transportFactory;
|
|
619
620
|
this._callbacks = _callbacks;
|
|
620
621
|
this._ctx = new import_context.Context();
|
|
622
|
+
this.connectedTimeoutContext = new import_context.Context();
|
|
621
623
|
this._state = ConnectionState.CREATED;
|
|
622
624
|
this._incomingSignalBuffer = [];
|
|
623
625
|
this._outgoingSignalBuffer = [];
|
|
@@ -636,7 +638,7 @@ var Connection = class {
|
|
|
636
638
|
initiator: this.initiator
|
|
637
639
|
}, {
|
|
638
640
|
F: __dxlog_file,
|
|
639
|
-
L:
|
|
641
|
+
L: 129,
|
|
640
642
|
S: this,
|
|
641
643
|
C: (f, a) => f(...a)
|
|
642
644
|
});
|
|
@@ -656,7 +658,7 @@ var Connection = class {
|
|
|
656
658
|
async openConnection() {
|
|
657
659
|
(0, import_invariant.invariant)(this._state === ConnectionState.INITIAL, "Invalid state.", {
|
|
658
660
|
F: __dxlog_file,
|
|
659
|
-
L:
|
|
661
|
+
L: 154,
|
|
660
662
|
S: this,
|
|
661
663
|
A: [
|
|
662
664
|
"this._state === ConnectionState.INITIAL",
|
|
@@ -667,7 +669,7 @@ var Connection = class {
|
|
|
667
669
|
id: this._instanceId
|
|
668
670
|
}), {
|
|
669
671
|
F: __dxlog_file,
|
|
670
|
-
L:
|
|
672
|
+
L: 155,
|
|
671
673
|
S: this,
|
|
672
674
|
C: (f, a) => f(...a)
|
|
673
675
|
});
|
|
@@ -679,7 +681,7 @@ var Connection = class {
|
|
|
679
681
|
initiator: this.initiator
|
|
680
682
|
}, {
|
|
681
683
|
F: __dxlog_file,
|
|
682
|
-
L:
|
|
684
|
+
L: 156,
|
|
683
685
|
S: this,
|
|
684
686
|
C: (f, a) => f(...a)
|
|
685
687
|
});
|
|
@@ -690,15 +692,24 @@ var Connection = class {
|
|
|
690
692
|
this._protocol.stream.on("close", () => {
|
|
691
693
|
(0, import_log.log)("protocol stream closed", void 0, {
|
|
692
694
|
F: __dxlog_file,
|
|
693
|
-
L:
|
|
695
|
+
L: 173,
|
|
694
696
|
S: this,
|
|
695
697
|
C: (f, a) => f(...a)
|
|
696
698
|
});
|
|
697
699
|
this.close(new import_protocols.ProtocolError("protocol stream closed")).catch((err) => this.errors.raise(err));
|
|
698
700
|
});
|
|
701
|
+
(0, import_async.scheduleTask)(this.connectedTimeoutContext, async () => {
|
|
702
|
+
import_log.log.warn("timeout waiting for transport to connect, aborting", void 0, {
|
|
703
|
+
F: __dxlog_file,
|
|
704
|
+
L: 180,
|
|
705
|
+
S: this,
|
|
706
|
+
C: (f, a) => f(...a)
|
|
707
|
+
});
|
|
708
|
+
await this.abort().catch((err) => this.errors.raise(err));
|
|
709
|
+
}, TRANSPORT_CONNECTION_TIMEOUT);
|
|
699
710
|
(0, import_invariant.invariant)(!this._transport, void 0, {
|
|
700
711
|
F: __dxlog_file,
|
|
701
|
-
L:
|
|
712
|
+
L: 186,
|
|
702
713
|
S: this,
|
|
703
714
|
A: [
|
|
704
715
|
"!this._transport",
|
|
@@ -710,26 +721,27 @@ var Connection = class {
|
|
|
710
721
|
stream: this._protocol.stream,
|
|
711
722
|
sendSignal: async (signal) => this._sendSignal(signal)
|
|
712
723
|
});
|
|
713
|
-
this._transport.connected.once(() => {
|
|
724
|
+
this._transport.connected.once(async () => {
|
|
714
725
|
this._changeState(ConnectionState.CONNECTED);
|
|
726
|
+
await this.connectedTimeoutContext.dispose();
|
|
715
727
|
this._callbacks?.onConnected?.();
|
|
716
728
|
});
|
|
717
729
|
this._transport.closed.once(() => {
|
|
718
730
|
this._transport = void 0;
|
|
719
731
|
(0, import_log.log)("abort triggered by transport close", void 0, {
|
|
720
732
|
F: __dxlog_file,
|
|
721
|
-
L:
|
|
733
|
+
L: 201,
|
|
722
734
|
S: this,
|
|
723
735
|
C: (f, a) => f(...a)
|
|
724
736
|
});
|
|
725
737
|
this.abort().catch((err) => this.errors.raise(err));
|
|
726
738
|
});
|
|
727
|
-
this._transport.errors.handle((err) => {
|
|
739
|
+
this._transport.errors.handle(async (err) => {
|
|
728
740
|
(0, import_log.log)("transport error:", {
|
|
729
741
|
err
|
|
730
742
|
}, {
|
|
731
743
|
F: __dxlog_file,
|
|
732
|
-
L:
|
|
744
|
+
L: 206,
|
|
733
745
|
S: this,
|
|
734
746
|
C: (f, a) => f(...a)
|
|
735
747
|
});
|
|
@@ -739,7 +751,7 @@ var Connection = class {
|
|
|
739
751
|
if (err instanceof import_protocols.ConnectionResetError) {
|
|
740
752
|
import_log.log.warn("aborting due to transport ConnectionResetError", void 0, {
|
|
741
753
|
F: __dxlog_file,
|
|
742
|
-
L:
|
|
754
|
+
L: 213,
|
|
743
755
|
S: this,
|
|
744
756
|
C: (f, a) => f(...a)
|
|
745
757
|
});
|
|
@@ -747,7 +759,7 @@ var Connection = class {
|
|
|
747
759
|
} else if (err instanceof import_protocols.ConnectivityError) {
|
|
748
760
|
import_log.log.warn("aborting due to transport ConnectivityError", void 0, {
|
|
749
761
|
F: __dxlog_file,
|
|
750
|
-
L:
|
|
762
|
+
L: 216,
|
|
751
763
|
S: this,
|
|
752
764
|
C: (f, a) => f(...a)
|
|
753
765
|
});
|
|
@@ -757,12 +769,13 @@ var Connection = class {
|
|
|
757
769
|
err
|
|
758
770
|
}, {
|
|
759
771
|
F: __dxlog_file,
|
|
760
|
-
L:
|
|
772
|
+
L: 219,
|
|
761
773
|
S: this,
|
|
762
774
|
C: (f, a) => f(...a)
|
|
763
775
|
});
|
|
764
776
|
}
|
|
765
777
|
if (this._state !== ConnectionState.CLOSED && this._state !== ConnectionState.CLOSING) {
|
|
778
|
+
await this.connectedTimeoutContext.dispose();
|
|
766
779
|
this.errors.raise(err);
|
|
767
780
|
}
|
|
768
781
|
});
|
|
@@ -774,7 +787,7 @@ var Connection = class {
|
|
|
774
787
|
id: this._instanceId
|
|
775
788
|
}), {
|
|
776
789
|
F: __dxlog_file,
|
|
777
|
-
L:
|
|
790
|
+
L: 235,
|
|
778
791
|
S: this,
|
|
779
792
|
C: (f, a) => f(...a)
|
|
780
793
|
});
|
|
@@ -784,19 +797,20 @@ var Connection = class {
|
|
|
784
797
|
err
|
|
785
798
|
}, {
|
|
786
799
|
F: __dxlog_file,
|
|
787
|
-
L:
|
|
800
|
+
L: 242,
|
|
788
801
|
S: this,
|
|
789
802
|
C: (f, a) => f(...a)
|
|
790
803
|
});
|
|
791
804
|
if (this._state === ConnectionState.CLOSED || this._state === ConnectionState.ABORTED) {
|
|
792
805
|
(0, import_log.log)(`abort ignored: already ${this._state}`, this.closeReason, {
|
|
793
806
|
F: __dxlog_file,
|
|
794
|
-
L:
|
|
807
|
+
L: 244,
|
|
795
808
|
S: this,
|
|
796
809
|
C: (f, a) => f(...a)
|
|
797
810
|
});
|
|
798
811
|
return;
|
|
799
812
|
}
|
|
813
|
+
await this.connectedTimeoutContext.dispose();
|
|
800
814
|
this._changeState(ConnectionState.ABORTING);
|
|
801
815
|
if (!this.closeReason) {
|
|
802
816
|
this.closeReason = err?.message;
|
|
@@ -807,7 +821,7 @@ var Connection = class {
|
|
|
807
821
|
proto: this._protocol
|
|
808
822
|
}, {
|
|
809
823
|
F: __dxlog_file,
|
|
810
|
-
L:
|
|
824
|
+
L: 258,
|
|
811
825
|
S: this,
|
|
812
826
|
C: (f, a) => f(...a)
|
|
813
827
|
});
|
|
@@ -815,7 +829,7 @@ var Connection = class {
|
|
|
815
829
|
} catch (err2) {
|
|
816
830
|
import_log.log.catch(err2, void 0, {
|
|
817
831
|
F: __dxlog_file,
|
|
818
|
-
L:
|
|
832
|
+
L: 261,
|
|
819
833
|
S: this,
|
|
820
834
|
C: (f, a) => f(...a)
|
|
821
835
|
});
|
|
@@ -825,7 +839,7 @@ var Connection = class {
|
|
|
825
839
|
} catch (err2) {
|
|
826
840
|
import_log.log.catch(err2, void 0, {
|
|
827
841
|
F: __dxlog_file,
|
|
828
|
-
L:
|
|
842
|
+
L: 268,
|
|
829
843
|
S: this,
|
|
830
844
|
C: (f, a) => f(...a)
|
|
831
845
|
});
|
|
@@ -835,7 +849,7 @@ var Connection = class {
|
|
|
835
849
|
} catch (err2) {
|
|
836
850
|
import_log.log.catch(err2, void 0, {
|
|
837
851
|
F: __dxlog_file,
|
|
838
|
-
L:
|
|
852
|
+
L: 274,
|
|
839
853
|
S: this,
|
|
840
854
|
C: (f, a) => f(...a)
|
|
841
855
|
});
|
|
@@ -845,18 +859,21 @@ var Connection = class {
|
|
|
845
859
|
async close(err) {
|
|
846
860
|
if (!this.closeReason) {
|
|
847
861
|
this.closeReason = err?.message;
|
|
862
|
+
} else {
|
|
863
|
+
this.closeReason += `; ${err?.message}`;
|
|
848
864
|
}
|
|
849
865
|
if (this._state === ConnectionState.CLOSED || this._state === ConnectionState.ABORTING || this._state === ConnectionState.ABORTED) {
|
|
850
866
|
return;
|
|
851
867
|
}
|
|
852
868
|
const lastState = this._state;
|
|
853
869
|
this._changeState(ConnectionState.CLOSING);
|
|
870
|
+
await this.connectedTimeoutContext.dispose();
|
|
854
871
|
await this._ctx.dispose();
|
|
855
872
|
(0, import_log.log)("closing...", {
|
|
856
873
|
peerId: this.ownId
|
|
857
874
|
}, {
|
|
858
875
|
F: __dxlog_file,
|
|
859
|
-
L:
|
|
876
|
+
L: 299,
|
|
860
877
|
S: this,
|
|
861
878
|
C: (f, a) => f(...a)
|
|
862
879
|
});
|
|
@@ -866,7 +883,7 @@ var Connection = class {
|
|
|
866
883
|
} catch (err2) {
|
|
867
884
|
import_log.log.catch(err2, void 0, {
|
|
868
885
|
F: __dxlog_file,
|
|
869
|
-
L:
|
|
886
|
+
L: 306,
|
|
870
887
|
S: this,
|
|
871
888
|
C: (f, a) => f(...a)
|
|
872
889
|
});
|
|
@@ -876,7 +893,7 @@ var Connection = class {
|
|
|
876
893
|
} catch (err2) {
|
|
877
894
|
import_log.log.catch(err2, void 0, {
|
|
878
895
|
F: __dxlog_file,
|
|
879
|
-
L:
|
|
896
|
+
L: 313,
|
|
880
897
|
S: this,
|
|
881
898
|
C: (f, a) => f(...a)
|
|
882
899
|
});
|
|
@@ -886,7 +903,7 @@ var Connection = class {
|
|
|
886
903
|
peerId: this.ownId
|
|
887
904
|
}, {
|
|
888
905
|
F: __dxlog_file,
|
|
889
|
-
L:
|
|
906
|
+
L: 317,
|
|
890
907
|
S: this,
|
|
891
908
|
C: (f, a) => f(...a)
|
|
892
909
|
});
|
|
@@ -922,14 +939,14 @@ var Connection = class {
|
|
|
922
939
|
}
|
|
923
940
|
});
|
|
924
941
|
} catch (err) {
|
|
925
|
-
if (err instanceof import_protocols.CancelledError) {
|
|
942
|
+
if (err instanceof import_protocols.CancelledError || err instanceof Error && err.message?.includes("CANCELLED")) {
|
|
926
943
|
return;
|
|
927
944
|
}
|
|
928
945
|
import_log.log.warn("signal failed", {
|
|
929
946
|
err
|
|
930
947
|
}, {
|
|
931
948
|
F: __dxlog_file,
|
|
932
|
-
L:
|
|
949
|
+
L: 355,
|
|
933
950
|
S: this,
|
|
934
951
|
C: (f, a) => f(...a)
|
|
935
952
|
});
|
|
@@ -942,7 +959,7 @@ var Connection = class {
|
|
|
942
959
|
async signal(msg) {
|
|
943
960
|
(0, import_invariant.invariant)(msg.sessionId, void 0, {
|
|
944
961
|
F: __dxlog_file,
|
|
945
|
-
L:
|
|
962
|
+
L: 364,
|
|
946
963
|
S: this,
|
|
947
964
|
A: [
|
|
948
965
|
"msg.sessionId",
|
|
@@ -952,7 +969,7 @@ var Connection = class {
|
|
|
952
969
|
if (!msg.sessionId.equals(this.sessionId)) {
|
|
953
970
|
(0, import_log.log)("dropping signal for incorrect session id", void 0, {
|
|
954
971
|
F: __dxlog_file,
|
|
955
|
-
L:
|
|
972
|
+
L: 366,
|
|
956
973
|
S: this,
|
|
957
974
|
C: (f, a) => f(...a)
|
|
958
975
|
});
|
|
@@ -960,7 +977,7 @@ var Connection = class {
|
|
|
960
977
|
}
|
|
961
978
|
(0, import_invariant.invariant)(msg.data.signal || msg.data.signalBatch, void 0, {
|
|
962
979
|
F: __dxlog_file,
|
|
963
|
-
L:
|
|
980
|
+
L: 369,
|
|
964
981
|
S: this,
|
|
965
982
|
A: [
|
|
966
983
|
"msg.data.signal || msg.data.signalBatch",
|
|
@@ -969,7 +986,7 @@ var Connection = class {
|
|
|
969
986
|
});
|
|
970
987
|
(0, import_invariant.invariant)(msg.author?.equals(this.remoteId), void 0, {
|
|
971
988
|
F: __dxlog_file,
|
|
972
|
-
L:
|
|
989
|
+
L: 370,
|
|
973
990
|
S: this,
|
|
974
991
|
A: [
|
|
975
992
|
"msg.author?.equals(this.remoteId)",
|
|
@@ -978,7 +995,7 @@ var Connection = class {
|
|
|
978
995
|
});
|
|
979
996
|
(0, import_invariant.invariant)(msg.recipient?.equals(this.ownId), void 0, {
|
|
980
997
|
F: __dxlog_file,
|
|
981
|
-
L:
|
|
998
|
+
L: 371,
|
|
982
999
|
S: this,
|
|
983
1000
|
A: [
|
|
984
1001
|
"msg.recipient?.equals(this.ownId)",
|
|
@@ -1002,7 +1019,7 @@ var Connection = class {
|
|
|
1002
1019
|
msg: msg.data
|
|
1003
1020
|
}, {
|
|
1004
1021
|
F: __dxlog_file,
|
|
1005
|
-
L:
|
|
1022
|
+
L: 380,
|
|
1006
1023
|
S: this,
|
|
1007
1024
|
C: (f, a) => f(...a)
|
|
1008
1025
|
});
|
|
@@ -1010,7 +1027,7 @@ var Connection = class {
|
|
|
1010
1027
|
} else {
|
|
1011
1028
|
(0, import_invariant.invariant)(this._transport, "Connection not ready to accept signals.", {
|
|
1012
1029
|
F: __dxlog_file,
|
|
1013
|
-
L:
|
|
1030
|
+
L: 383,
|
|
1014
1031
|
S: this,
|
|
1015
1032
|
A: [
|
|
1016
1033
|
"this._transport",
|
|
@@ -1023,7 +1040,7 @@ var Connection = class {
|
|
|
1023
1040
|
msg: msg.data
|
|
1024
1041
|
}, {
|
|
1025
1042
|
F: __dxlog_file,
|
|
1026
|
-
L:
|
|
1043
|
+
L: 384,
|
|
1027
1044
|
S: this,
|
|
1028
1045
|
C: (f, a) => f(...a)
|
|
1029
1046
|
});
|
|
@@ -1041,13 +1058,13 @@ var Connection = class {
|
|
|
1041
1058
|
peerId: this.ownId
|
|
1042
1059
|
}, {
|
|
1043
1060
|
F: __dxlog_file,
|
|
1044
|
-
L:
|
|
1061
|
+
L: 395,
|
|
1045
1062
|
S: this,
|
|
1046
1063
|
C: (f, a) => f(...a)
|
|
1047
1064
|
});
|
|
1048
1065
|
(0, import_invariant.invariant)(state !== this._state, "Already in this state.", {
|
|
1049
1066
|
F: __dxlog_file,
|
|
1050
|
-
L:
|
|
1067
|
+
L: 396,
|
|
1051
1068
|
S: this,
|
|
1052
1069
|
A: [
|
|
1053
1070
|
"state !== this._state",
|
|
@@ -1092,7 +1109,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
1092
1109
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1093
1110
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1094
1111
|
}
|
|
1095
|
-
var __dxlog_file2 = "/
|
|
1112
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/peer.ts";
|
|
1096
1113
|
var ConnectionDisplacedError = class extends import_protocols2.SystemError {
|
|
1097
1114
|
constructor() {
|
|
1098
1115
|
super("Connection displaced by remote initiator.");
|
|
@@ -1124,11 +1141,12 @@ var Peer = class {
|
|
|
1124
1141
|
const remoteId = message.author;
|
|
1125
1142
|
if (this.connection && ![
|
|
1126
1143
|
ConnectionState.CREATED,
|
|
1127
|
-
ConnectionState.INITIAL
|
|
1144
|
+
ConnectionState.INITIAL,
|
|
1145
|
+
ConnectionState.CONNECTING
|
|
1128
1146
|
].includes(this.connection.state)) {
|
|
1129
1147
|
import_log2.log.info(`received offer when connection already in ${this.connection.state} state`, void 0, {
|
|
1130
1148
|
F: __dxlog_file2,
|
|
1131
|
-
L:
|
|
1149
|
+
L: 115,
|
|
1132
1150
|
S: this,
|
|
1133
1151
|
C: (f, a) => f(...a)
|
|
1134
1152
|
});
|
|
@@ -1145,7 +1163,7 @@ var Peer = class {
|
|
|
1145
1163
|
sessionId: this.connection?.sessionId
|
|
1146
1164
|
}, {
|
|
1147
1165
|
F: __dxlog_file2,
|
|
1148
|
-
L:
|
|
1166
|
+
L: 124,
|
|
1149
1167
|
S: this,
|
|
1150
1168
|
C: (f, a) => f(...a)
|
|
1151
1169
|
});
|
|
@@ -1162,7 +1180,7 @@ var Peer = class {
|
|
|
1162
1180
|
if (!this.connection) {
|
|
1163
1181
|
(0, import_invariant2.invariant)(message.sessionId, void 0, {
|
|
1164
1182
|
F: __dxlog_file2,
|
|
1165
|
-
L:
|
|
1183
|
+
L: 144,
|
|
1166
1184
|
S: this,
|
|
1167
1185
|
A: [
|
|
1168
1186
|
"message.sessionId",
|
|
@@ -1183,7 +1201,7 @@ var Peer = class {
|
|
|
1183
1201
|
err
|
|
1184
1202
|
}, {
|
|
1185
1203
|
F: __dxlog_file2,
|
|
1186
|
-
L:
|
|
1204
|
+
L: 154,
|
|
1187
1205
|
S: this,
|
|
1188
1206
|
C: (f, a) => f(...a)
|
|
1189
1207
|
});
|
|
@@ -1205,7 +1223,7 @@ var Peer = class {
|
|
|
1205
1223
|
async initiateConnection() {
|
|
1206
1224
|
(0, import_invariant2.invariant)(!this.initiating, "Initiation in progress.", {
|
|
1207
1225
|
F: __dxlog_file2,
|
|
1208
|
-
L:
|
|
1226
|
+
L: 171,
|
|
1209
1227
|
S: this,
|
|
1210
1228
|
A: [
|
|
1211
1229
|
"!this.initiating",
|
|
@@ -1214,7 +1232,7 @@ var Peer = class {
|
|
|
1214
1232
|
});
|
|
1215
1233
|
(0, import_invariant2.invariant)(!this.connection, "Already connected.", {
|
|
1216
1234
|
F: __dxlog_file2,
|
|
1217
|
-
L:
|
|
1235
|
+
L: 172,
|
|
1218
1236
|
S: this,
|
|
1219
1237
|
A: [
|
|
1220
1238
|
"!this.connection",
|
|
@@ -1229,16 +1247,17 @@ var Peer = class {
|
|
|
1229
1247
|
sessionId
|
|
1230
1248
|
}, {
|
|
1231
1249
|
F: __dxlog_file2,
|
|
1232
|
-
L:
|
|
1250
|
+
L: 174,
|
|
1233
1251
|
S: this,
|
|
1234
1252
|
C: (f, a) => f(...a)
|
|
1235
1253
|
});
|
|
1236
1254
|
const connection = this._createConnection(true, sessionId);
|
|
1237
1255
|
this.initiating = true;
|
|
1256
|
+
let answer;
|
|
1238
1257
|
try {
|
|
1239
1258
|
await this._connectionLimiter.connecting(sessionId);
|
|
1240
1259
|
connection.initiate();
|
|
1241
|
-
|
|
1260
|
+
answer = await this._signalMessaging.offer({
|
|
1242
1261
|
author: this.localPeerId,
|
|
1243
1262
|
recipient: this.id,
|
|
1244
1263
|
sessionId,
|
|
@@ -1254,46 +1273,87 @@ var Peer = class {
|
|
|
1254
1273
|
remoteId: this.id
|
|
1255
1274
|
}, {
|
|
1256
1275
|
F: __dxlog_file2,
|
|
1257
|
-
L:
|
|
1276
|
+
L: 191,
|
|
1258
1277
|
S: this,
|
|
1259
1278
|
C: (f, a) => f(...a)
|
|
1260
1279
|
});
|
|
1261
1280
|
if (connection.state !== ConnectionState.INITIAL) {
|
|
1262
1281
|
(0, import_log2.log)("ignoring response", void 0, {
|
|
1263
1282
|
F: __dxlog_file2,
|
|
1264
|
-
L:
|
|
1283
|
+
L: 193,
|
|
1265
1284
|
S: this,
|
|
1266
1285
|
C: (f, a) => f(...a)
|
|
1267
1286
|
});
|
|
1268
1287
|
return;
|
|
1269
1288
|
}
|
|
1289
|
+
} catch (err) {
|
|
1290
|
+
(0, import_log2.log)("initiation error: send offer", {
|
|
1291
|
+
err,
|
|
1292
|
+
topic: this.topic,
|
|
1293
|
+
peerId: this.localPeerId,
|
|
1294
|
+
remoteId: this.id
|
|
1295
|
+
}, {
|
|
1296
|
+
F: __dxlog_file2,
|
|
1297
|
+
L: 197,
|
|
1298
|
+
S: this,
|
|
1299
|
+
C: (f, a) => f(...a)
|
|
1300
|
+
});
|
|
1301
|
+
await connection.abort(err);
|
|
1302
|
+
throw err;
|
|
1303
|
+
} finally {
|
|
1304
|
+
this.initiating = false;
|
|
1305
|
+
}
|
|
1306
|
+
try {
|
|
1270
1307
|
if (!answer.accept) {
|
|
1271
1308
|
this._callbacks.onRejected();
|
|
1272
1309
|
return;
|
|
1273
1310
|
}
|
|
1311
|
+
} catch (err) {
|
|
1312
|
+
(0, import_log2.log)("initiation error: accept answer", {
|
|
1313
|
+
err,
|
|
1314
|
+
topic: this.topic,
|
|
1315
|
+
peerId: this.localPeerId,
|
|
1316
|
+
remoteId: this.id
|
|
1317
|
+
}, {
|
|
1318
|
+
F: __dxlog_file2,
|
|
1319
|
+
L: 210,
|
|
1320
|
+
S: this,
|
|
1321
|
+
C: (f, a) => f(...a)
|
|
1322
|
+
});
|
|
1323
|
+
await connection.abort(err);
|
|
1324
|
+
throw err;
|
|
1325
|
+
} finally {
|
|
1326
|
+
this.initiating = false;
|
|
1327
|
+
}
|
|
1328
|
+
try {
|
|
1329
|
+
(0, import_log2.log)("opening connection as initiator", void 0, {
|
|
1330
|
+
F: __dxlog_file2,
|
|
1331
|
+
L: 223,
|
|
1332
|
+
S: this,
|
|
1333
|
+
C: (f, a) => f(...a)
|
|
1334
|
+
});
|
|
1274
1335
|
await connection.openConnection();
|
|
1275
1336
|
this._callbacks.onAccepted();
|
|
1276
1337
|
} catch (err) {
|
|
1277
|
-
(0, import_log2.log)("initiation error", {
|
|
1338
|
+
(0, import_log2.log)("initiation error: open connection", {
|
|
1278
1339
|
err,
|
|
1279
1340
|
topic: this.topic,
|
|
1280
1341
|
peerId: this.localPeerId,
|
|
1281
1342
|
remoteId: this.id
|
|
1282
1343
|
}, {
|
|
1283
1344
|
F: __dxlog_file2,
|
|
1284
|
-
L:
|
|
1345
|
+
L: 227,
|
|
1346
|
+
S: this,
|
|
1347
|
+
C: (f, a) => f(...a)
|
|
1348
|
+
});
|
|
1349
|
+
import_log2.log.warn("closing connection due to unhandled error on openConnection", {
|
|
1350
|
+
err
|
|
1351
|
+
}, {
|
|
1352
|
+
F: __dxlog_file2,
|
|
1353
|
+
L: 234,
|
|
1285
1354
|
S: this,
|
|
1286
1355
|
C: (f, a) => f(...a)
|
|
1287
1356
|
});
|
|
1288
|
-
if (err instanceof import_protocols2.TimeoutError) {
|
|
1289
|
-
import_log2.log.warn("aborting connection due to signalling failure", void 0, {
|
|
1290
|
-
F: __dxlog_file2,
|
|
1291
|
-
L: 202,
|
|
1292
|
-
S: this,
|
|
1293
|
-
C: (f, a) => f(...a)
|
|
1294
|
-
});
|
|
1295
|
-
await connection.abort(err);
|
|
1296
|
-
}
|
|
1297
1357
|
await this.closeConnection(err);
|
|
1298
1358
|
throw err;
|
|
1299
1359
|
} finally {
|
|
@@ -1313,13 +1373,13 @@ var Peer = class {
|
|
|
1313
1373
|
sessionId
|
|
1314
1374
|
}, {
|
|
1315
1375
|
F: __dxlog_file2,
|
|
1316
|
-
L:
|
|
1376
|
+
L: 248,
|
|
1317
1377
|
S: this,
|
|
1318
1378
|
C: (f, a) => f(...a)
|
|
1319
1379
|
});
|
|
1320
1380
|
(0, import_invariant2.invariant)(!this.connection, "Already connected.", {
|
|
1321
1381
|
F: __dxlog_file2,
|
|
1322
|
-
L:
|
|
1382
|
+
L: 255,
|
|
1323
1383
|
S: this,
|
|
1324
1384
|
A: [
|
|
1325
1385
|
"!this.connection",
|
|
@@ -1355,7 +1415,7 @@ var Peer = class {
|
|
|
1355
1415
|
initiator
|
|
1356
1416
|
}, {
|
|
1357
1417
|
F: __dxlog_file2,
|
|
1358
|
-
L:
|
|
1418
|
+
L: 274,
|
|
1359
1419
|
S: this,
|
|
1360
1420
|
C: (f, a) => f(...a)
|
|
1361
1421
|
});
|
|
@@ -1368,14 +1428,14 @@ var Peer = class {
|
|
|
1368
1428
|
initiator
|
|
1369
1429
|
}, {
|
|
1370
1430
|
F: __dxlog_file2,
|
|
1371
|
-
L:
|
|
1431
|
+
L: 283,
|
|
1372
1432
|
S: this,
|
|
1373
1433
|
C: (f, a) => f(...a)
|
|
1374
1434
|
});
|
|
1375
1435
|
this._connectionLimiter.doneConnecting(sessionId);
|
|
1376
1436
|
(0, import_invariant2.invariant)(this.connection === connection, "Connection mismatch (race condition).", {
|
|
1377
1437
|
F: __dxlog_file2,
|
|
1378
|
-
L:
|
|
1438
|
+
L: 288,
|
|
1379
1439
|
S: this,
|
|
1380
1440
|
A: [
|
|
1381
1441
|
"this.connection === connection",
|
|
@@ -1390,7 +1450,7 @@ var Peer = class {
|
|
|
1390
1450
|
initiator
|
|
1391
1451
|
}, {
|
|
1392
1452
|
F: __dxlog_file2,
|
|
1393
|
-
L:
|
|
1453
|
+
L: 290,
|
|
1394
1454
|
S: this,
|
|
1395
1455
|
C: (f, a) => f(...a)
|
|
1396
1456
|
});
|
|
@@ -1417,7 +1477,7 @@ var Peer = class {
|
|
|
1417
1477
|
void this._connectionCtx?.dispose();
|
|
1418
1478
|
this._connectionCtx = this._ctx.derive();
|
|
1419
1479
|
connection.errors.handle((err) => {
|
|
1420
|
-
import_log2.log.warn("connection error", {
|
|
1480
|
+
import_log2.log.warn("connection error, closing", {
|
|
1421
1481
|
topic: this.topic,
|
|
1422
1482
|
peerId: this.localPeerId,
|
|
1423
1483
|
remoteId: this.id,
|
|
@@ -1425,7 +1485,7 @@ var Peer = class {
|
|
|
1425
1485
|
err
|
|
1426
1486
|
}, {
|
|
1427
1487
|
F: __dxlog_file2,
|
|
1428
|
-
L:
|
|
1488
|
+
L: 330,
|
|
1429
1489
|
S: this,
|
|
1430
1490
|
C: (f, a) => f(...a)
|
|
1431
1491
|
});
|
|
@@ -1438,7 +1498,7 @@ var Peer = class {
|
|
|
1438
1498
|
err
|
|
1439
1499
|
}, {
|
|
1440
1500
|
F: __dxlog_file2,
|
|
1441
|
-
L:
|
|
1501
|
+
L: 337,
|
|
1442
1502
|
S: this,
|
|
1443
1503
|
C: (f, a) => f(...a)
|
|
1444
1504
|
});
|
|
@@ -1457,7 +1517,7 @@ var Peer = class {
|
|
|
1457
1517
|
sessionId: connection.sessionId
|
|
1458
1518
|
}, {
|
|
1459
1519
|
F: __dxlog_file2,
|
|
1460
|
-
L:
|
|
1520
|
+
L: 362,
|
|
1461
1521
|
S: this,
|
|
1462
1522
|
C: (f, a) => f(...a)
|
|
1463
1523
|
});
|
|
@@ -1467,7 +1527,7 @@ var Peer = class {
|
|
|
1467
1527
|
sessionId: connection.sessionId
|
|
1468
1528
|
}, {
|
|
1469
1529
|
F: __dxlog_file2,
|
|
1470
|
-
L:
|
|
1530
|
+
L: 368,
|
|
1471
1531
|
S: this,
|
|
1472
1532
|
C: (f, a) => f(...a)
|
|
1473
1533
|
});
|
|
@@ -1478,7 +1538,7 @@ var Peer = class {
|
|
|
1478
1538
|
message
|
|
1479
1539
|
}, {
|
|
1480
1540
|
F: __dxlog_file2,
|
|
1481
|
-
L:
|
|
1541
|
+
L: 373,
|
|
1482
1542
|
S: this,
|
|
1483
1543
|
C: (f, a) => f(...a)
|
|
1484
1544
|
});
|
|
@@ -1486,18 +1546,18 @@ var Peer = class {
|
|
|
1486
1546
|
}
|
|
1487
1547
|
await this.connection.signal(message);
|
|
1488
1548
|
}
|
|
1489
|
-
async destroy() {
|
|
1549
|
+
async destroy(reason) {
|
|
1490
1550
|
await this._ctx.dispose();
|
|
1491
1551
|
(0, import_log2.log)("Destroying peer", {
|
|
1492
1552
|
peerId: this.id,
|
|
1493
1553
|
topic: this.topic
|
|
1494
1554
|
}, {
|
|
1495
1555
|
F: __dxlog_file2,
|
|
1496
|
-
L:
|
|
1556
|
+
L: 383,
|
|
1497
1557
|
S: this,
|
|
1498
1558
|
C: (f, a) => f(...a)
|
|
1499
1559
|
});
|
|
1500
|
-
await this?.connection?.close();
|
|
1560
|
+
await this?.connection?.close(reason);
|
|
1501
1561
|
}
|
|
1502
1562
|
};
|
|
1503
1563
|
_ts_decorate2([
|
|
@@ -1523,7 +1583,7 @@ var import_keys3 = require("@dxos/keys");
|
|
|
1523
1583
|
var import_log3 = require("@dxos/log");
|
|
1524
1584
|
var import_protocols3 = require("@dxos/protocols");
|
|
1525
1585
|
var import_util = require("@dxos/util");
|
|
1526
|
-
var __dxlog_file3 = "/
|
|
1586
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/signal/swarm-messenger.ts";
|
|
1527
1587
|
var SwarmMessage = import_protocols3.schema.getCodecForType("dxos.mesh.swarm.SwarmMessage");
|
|
1528
1588
|
var SwarmMessenger = class {
|
|
1529
1589
|
constructor({ sendMessage, onSignal, onOffer, topic }) {
|
|
@@ -1759,7 +1819,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
1759
1819
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1760
1820
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1761
1821
|
}
|
|
1762
|
-
var __dxlog_file4 = "/
|
|
1822
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/swarm.ts";
|
|
1763
1823
|
var INITIATION_DELAY = 100;
|
|
1764
1824
|
var getClassName = (obj) => Object.getPrototypeOf(obj).constructor.name;
|
|
1765
1825
|
var Swarm = class {
|
|
@@ -1870,7 +1930,7 @@ var Swarm = class {
|
|
|
1870
1930
|
this._listeningHandle = void 0;
|
|
1871
1931
|
await this._ctx.dispose();
|
|
1872
1932
|
await this._topology.destroy();
|
|
1873
|
-
await Promise.all(Array.from(this._peers.keys()).map((key) => this._destroyPeer(key)));
|
|
1933
|
+
await Promise.all(Array.from(this._peers.keys()).map((key) => this._destroyPeer(key, "swarm destroyed")));
|
|
1874
1934
|
(0, import_log4.log)("destroyed", void 0, {
|
|
1875
1935
|
F: __dxlog_file4,
|
|
1876
1936
|
L: 148,
|
|
@@ -1942,13 +2002,22 @@ var Swarm = class {
|
|
|
1942
2002
|
if (peer) {
|
|
1943
2003
|
peer.advertizing = false;
|
|
1944
2004
|
if (peer.connection?.state !== ConnectionState.CONNECTED) {
|
|
1945
|
-
void this._destroyPeer(peer.id).catch((err) => import_log4.log.catch(err, void 0, {
|
|
2005
|
+
void this._destroyPeer(peer.id, "peer left").catch((err) => import_log4.log.catch(err, void 0, {
|
|
1946
2006
|
F: __dxlog_file4,
|
|
1947
2007
|
L: 189,
|
|
1948
2008
|
S: this,
|
|
1949
2009
|
C: (f, a) => f(...a)
|
|
1950
2010
|
}));
|
|
1951
2011
|
}
|
|
2012
|
+
} else {
|
|
2013
|
+
(0, import_log4.log)("received peerLeft but no peer found", {
|
|
2014
|
+
peer: swarmEvent.peerLeft.peer
|
|
2015
|
+
}, {
|
|
2016
|
+
F: __dxlog_file4,
|
|
2017
|
+
L: 192,
|
|
2018
|
+
S: this,
|
|
2019
|
+
C: (f, a) => f(...a)
|
|
2020
|
+
});
|
|
1952
2021
|
}
|
|
1953
2022
|
}
|
|
1954
2023
|
this._topology.update();
|
|
@@ -1958,14 +2027,14 @@ var Swarm = class {
|
|
|
1958
2027
|
message
|
|
1959
2028
|
}, {
|
|
1960
2029
|
F: __dxlog_file4,
|
|
1961
|
-
L:
|
|
2030
|
+
L: 201,
|
|
1962
2031
|
S: this,
|
|
1963
2032
|
C: (f, a) => f(...a)
|
|
1964
2033
|
});
|
|
1965
2034
|
if (this._ctx.disposed) {
|
|
1966
2035
|
(0, import_log4.log)("ignored for disposed swarm", void 0, {
|
|
1967
2036
|
F: __dxlog_file4,
|
|
1968
|
-
L:
|
|
2037
|
+
L: 203,
|
|
1969
2038
|
S: this,
|
|
1970
2039
|
C: (f, a) => f(...a)
|
|
1971
2040
|
});
|
|
@@ -1975,7 +2044,7 @@ var Swarm = class {
|
|
|
1975
2044
|
}
|
|
1976
2045
|
(0, import_invariant4.invariant)(message.author, void 0, {
|
|
1977
2046
|
F: __dxlog_file4,
|
|
1978
|
-
L:
|
|
2047
|
+
L: 208,
|
|
1979
2048
|
S: this,
|
|
1980
2049
|
A: [
|
|
1981
2050
|
"message.author",
|
|
@@ -1987,7 +2056,7 @@ var Swarm = class {
|
|
|
1987
2056
|
message
|
|
1988
2057
|
}, {
|
|
1989
2058
|
F: __dxlog_file4,
|
|
1990
|
-
L:
|
|
2059
|
+
L: 210,
|
|
1991
2060
|
S: this,
|
|
1992
2061
|
C: (f, a) => f(...a)
|
|
1993
2062
|
});
|
|
@@ -2000,7 +2069,7 @@ var Swarm = class {
|
|
|
2000
2069
|
message
|
|
2001
2070
|
}, {
|
|
2002
2071
|
F: __dxlog_file4,
|
|
2003
|
-
L:
|
|
2072
|
+
L: 214,
|
|
2004
2073
|
S: this,
|
|
2005
2074
|
C: (f, a) => f(...a)
|
|
2006
2075
|
});
|
|
@@ -2018,14 +2087,14 @@ var Swarm = class {
|
|
|
2018
2087
|
message
|
|
2019
2088
|
}, {
|
|
2020
2089
|
F: __dxlog_file4,
|
|
2021
|
-
L:
|
|
2090
|
+
L: 225,
|
|
2022
2091
|
S: this,
|
|
2023
2092
|
C: (f, a) => f(...a)
|
|
2024
2093
|
});
|
|
2025
2094
|
if (this._ctx.disposed) {
|
|
2026
2095
|
import_log4.log.info("ignored for offline swarm", void 0, {
|
|
2027
2096
|
F: __dxlog_file4,
|
|
2028
|
-
L:
|
|
2097
|
+
L: 227,
|
|
2029
2098
|
S: this,
|
|
2030
2099
|
C: (f, a) => f(...a)
|
|
2031
2100
|
});
|
|
@@ -2033,7 +2102,7 @@ var Swarm = class {
|
|
|
2033
2102
|
}
|
|
2034
2103
|
(0, import_invariant4.invariant)(message.recipient?.equals(this._ownPeerId), `Invalid signal peer id expected=${this.ownPeerId}, actual=${message.recipient}`, {
|
|
2035
2104
|
F: __dxlog_file4,
|
|
2036
|
-
L:
|
|
2105
|
+
L: 230,
|
|
2037
2106
|
S: this,
|
|
2038
2107
|
A: [
|
|
2039
2108
|
"message.recipient?.equals(this._ownPeerId)",
|
|
@@ -2042,7 +2111,7 @@ var Swarm = class {
|
|
|
2042
2111
|
});
|
|
2043
2112
|
(0, import_invariant4.invariant)(message.topic?.equals(this._topic), void 0, {
|
|
2044
2113
|
F: __dxlog_file4,
|
|
2045
|
-
L:
|
|
2114
|
+
L: 234,
|
|
2046
2115
|
S: this,
|
|
2047
2116
|
A: [
|
|
2048
2117
|
"message.topic?.equals(this._topic)",
|
|
@@ -2051,7 +2120,7 @@ var Swarm = class {
|
|
|
2051
2120
|
});
|
|
2052
2121
|
(0, import_invariant4.invariant)(message.author, void 0, {
|
|
2053
2122
|
F: __dxlog_file4,
|
|
2054
|
-
L:
|
|
2123
|
+
L: 235,
|
|
2055
2124
|
S: this,
|
|
2056
2125
|
A: [
|
|
2057
2126
|
"message.author",
|
|
@@ -2066,7 +2135,7 @@ var Swarm = class {
|
|
|
2066
2135
|
await this._ctx.dispose();
|
|
2067
2136
|
await Promise.all([
|
|
2068
2137
|
...this._peers.keys()
|
|
2069
|
-
].map((peerId) => this._destroyPeer(peerId)));
|
|
2138
|
+
].map((peerId) => this._destroyPeer(peerId, "goOffline")));
|
|
2070
2139
|
}
|
|
2071
2140
|
// For debug purposes
|
|
2072
2141
|
async goOnline() {
|
|
@@ -2084,14 +2153,22 @@ var Swarm = class {
|
|
|
2084
2153
|
},
|
|
2085
2154
|
onDisconnected: async () => {
|
|
2086
2155
|
if (!peer.advertizing) {
|
|
2087
|
-
await this._destroyPeer(peer.id);
|
|
2156
|
+
await this._destroyPeer(peer.id, "peer disconnected");
|
|
2088
2157
|
}
|
|
2089
2158
|
this.disconnected.emit(peerId);
|
|
2090
2159
|
this._topology.update();
|
|
2091
2160
|
},
|
|
2092
2161
|
onRejected: () => {
|
|
2093
2162
|
if (this._peers.has(peerId)) {
|
|
2094
|
-
|
|
2163
|
+
(0, import_log4.log)("peer rejected connection", {
|
|
2164
|
+
peerId
|
|
2165
|
+
}, {
|
|
2166
|
+
F: __dxlog_file4,
|
|
2167
|
+
L: 284,
|
|
2168
|
+
S: this,
|
|
2169
|
+
C: (f, a) => f(...a)
|
|
2170
|
+
});
|
|
2171
|
+
void this._destroyPeer(peerId, "peer rejected connection");
|
|
2095
2172
|
}
|
|
2096
2173
|
},
|
|
2097
2174
|
onAccepted: () => {
|
|
@@ -2108,17 +2185,17 @@ var Swarm = class {
|
|
|
2108
2185
|
}
|
|
2109
2186
|
return peer;
|
|
2110
2187
|
}
|
|
2111
|
-
async _destroyPeer(peerId) {
|
|
2188
|
+
async _destroyPeer(peerId, reason) {
|
|
2112
2189
|
(0, import_invariant4.invariant)(this._peers.has(peerId), void 0, {
|
|
2113
2190
|
F: __dxlog_file4,
|
|
2114
|
-
L:
|
|
2191
|
+
L: 306,
|
|
2115
2192
|
S: this,
|
|
2116
2193
|
A: [
|
|
2117
2194
|
"this._peers.has(peerId)",
|
|
2118
2195
|
""
|
|
2119
2196
|
]
|
|
2120
2197
|
});
|
|
2121
|
-
await this._peers.get(peerId).destroy();
|
|
2198
|
+
await this._peers.get(peerId).destroy(new Error(reason));
|
|
2122
2199
|
this._peers.delete(peerId);
|
|
2123
2200
|
}
|
|
2124
2201
|
_getSwarmController() {
|
|
@@ -2138,7 +2215,7 @@ var Swarm = class {
|
|
|
2138
2215
|
} catch (err) {
|
|
2139
2216
|
(0, import_log4.log)("initiation error", err, {
|
|
2140
2217
|
F: __dxlog_file4,
|
|
2141
|
-
L:
|
|
2218
|
+
L: 332,
|
|
2142
2219
|
S: this,
|
|
2143
2220
|
C: (f, a) => f(...a)
|
|
2144
2221
|
});
|
|
@@ -2166,7 +2243,7 @@ var Swarm = class {
|
|
|
2166
2243
|
remoteId
|
|
2167
2244
|
}, {
|
|
2168
2245
|
F: __dxlog_file4,
|
|
2169
|
-
L:
|
|
2246
|
+
L: 359,
|
|
2170
2247
|
S: this,
|
|
2171
2248
|
C: (f, a) => f(...a)
|
|
2172
2249
|
});
|
|
@@ -2183,7 +2260,7 @@ var Swarm = class {
|
|
|
2183
2260
|
remoteId
|
|
2184
2261
|
}, {
|
|
2185
2262
|
F: __dxlog_file4,
|
|
2186
|
-
L:
|
|
2263
|
+
L: 373,
|
|
2187
2264
|
S: this,
|
|
2188
2265
|
C: (f, a) => f(...a)
|
|
2189
2266
|
});
|
|
@@ -2193,7 +2270,7 @@ var Swarm = class {
|
|
|
2193
2270
|
remoteId
|
|
2194
2271
|
}, {
|
|
2195
2272
|
F: __dxlog_file4,
|
|
2196
|
-
L:
|
|
2273
|
+
L: 376,
|
|
2197
2274
|
S: this,
|
|
2198
2275
|
C: (f, a) => f(...a)
|
|
2199
2276
|
});
|
|
@@ -2233,7 +2310,7 @@ var import_async4 = require("@dxos/async");
|
|
|
2233
2310
|
var import_keys5 = require("@dxos/keys");
|
|
2234
2311
|
var import_log5 = require("@dxos/log");
|
|
2235
2312
|
var import_util3 = require("@dxos/util");
|
|
2236
|
-
var __dxlog_file5 = "/
|
|
2313
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/swarm-mapper.ts";
|
|
2237
2314
|
var SwarmMapper = class {
|
|
2238
2315
|
get peers() {
|
|
2239
2316
|
return Array.from(this._peers.values());
|
|
@@ -2305,7 +2382,7 @@ var import_keys6 = require("@dxos/keys");
|
|
|
2305
2382
|
var import_log6 = require("@dxos/log");
|
|
2306
2383
|
var import_protocols5 = require("@dxos/protocols");
|
|
2307
2384
|
var import_util4 = require("@dxos/util");
|
|
2308
|
-
var __dxlog_file6 = "/
|
|
2385
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection-limiter.ts";
|
|
2309
2386
|
var MAX_CONCURRENT_INITIATING_CONNECTIONS = 50;
|
|
2310
2387
|
var ConnectionLimiter = class {
|
|
2311
2388
|
constructor({ maxConcurrentInitConnections = MAX_CONCURRENT_INITIATING_CONNECTIONS } = {}) {
|
|
@@ -2454,7 +2531,7 @@ var import_messaging = require("@dxos/messaging");
|
|
|
2454
2531
|
var import_protocols6 = require("@dxos/protocols");
|
|
2455
2532
|
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
2456
2533
|
var import_util6 = require("@dxos/util");
|
|
2457
|
-
var __dxlog_file7 = "/
|
|
2534
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/network-manager.ts";
|
|
2458
2535
|
var NetworkManager = class {
|
|
2459
2536
|
constructor({ transportFactory, signalManager, log: log1 }) {
|
|
2460
2537
|
/**
|
|
@@ -2690,7 +2767,7 @@ var NetworkManager = class {
|
|
|
2690
2767
|
|
|
2691
2768
|
// packages/core/mesh/network-manager/src/topology/fully-connected-topology.ts
|
|
2692
2769
|
var import_invariant7 = require("@dxos/invariant");
|
|
2693
|
-
var __dxlog_file8 = "/
|
|
2770
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/fully-connected-topology.ts";
|
|
2694
2771
|
var FullyConnectedTopology = class {
|
|
2695
2772
|
toString() {
|
|
2696
2773
|
return "FullyConnectedTopology";
|
|
@@ -2733,7 +2810,7 @@ var FullyConnectedTopology = class {
|
|
|
2733
2810
|
var import_xor_distance = __toESM(require("xor-distance"));
|
|
2734
2811
|
var import_invariant8 = require("@dxos/invariant");
|
|
2735
2812
|
var import_log8 = require("@dxos/log");
|
|
2736
|
-
var __dxlog_file9 = "/
|
|
2813
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/mmst-topology.ts";
|
|
2737
2814
|
var MMSTTopology = class {
|
|
2738
2815
|
constructor({ originateConnections = 2, maxPeers = 4, sampleSize = 10 } = {}) {
|
|
2739
2816
|
this._sampleCollected = false;
|
|
@@ -2842,7 +2919,7 @@ var sortByXorDistance = (keys, reference) => keys.sort((a, b) => import_xor_dist
|
|
|
2842
2919
|
// packages/core/mesh/network-manager/src/topology/star-topology.ts
|
|
2843
2920
|
var import_invariant9 = require("@dxos/invariant");
|
|
2844
2921
|
var import_log9 = require("@dxos/log");
|
|
2845
|
-
var __dxlog_file10 = "/
|
|
2922
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/star-topology.ts";
|
|
2846
2923
|
var StarTopology = class {
|
|
2847
2924
|
constructor(_centralPeer) {
|
|
2848
2925
|
this._centralPeer = _centralPeer;
|
|
@@ -2953,7 +3030,7 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
2953
3030
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2954
3031
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2955
3032
|
}
|
|
2956
|
-
var __dxlog_file11 = "/
|
|
3033
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/memory-transport.ts";
|
|
2957
3034
|
var MEMORY_TRANSPORT_DELAY = 1;
|
|
2958
3035
|
var createStreamDelay = (delay) => {
|
|
2959
3036
|
return new import_node_stream.Transform({
|
|
@@ -3148,7 +3225,7 @@ try {
|
|
|
3148
3225
|
}
|
|
3149
3226
|
|
|
3150
3227
|
// packages/core/mesh/network-manager/src/transport/simplepeer-transport.ts
|
|
3151
|
-
var __dxlog_file12 = "/
|
|
3228
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport.ts";
|
|
3152
3229
|
var SimplePeerTransport = class {
|
|
3153
3230
|
constructor(params) {
|
|
3154
3231
|
this.params = params;
|
|
@@ -3337,7 +3414,7 @@ var import_keys11 = require("@dxos/keys");
|
|
|
3337
3414
|
var import_log12 = require("@dxos/log");
|
|
3338
3415
|
var import_bridge = require("@dxos/protocols/proto/dxos/mesh/bridge");
|
|
3339
3416
|
var import_util8 = require("@dxos/util");
|
|
3340
|
-
var __dxlog_file13 = "/
|
|
3417
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport-service.ts";
|
|
3341
3418
|
var SimplePeerTransportService = class {
|
|
3342
3419
|
constructor(_webrtcConfig) {
|
|
3343
3420
|
this._webrtcConfig = _webrtcConfig;
|
|
@@ -3480,7 +3557,7 @@ var import_log13 = require("@dxos/log");
|
|
|
3480
3557
|
var import_protocols8 = require("@dxos/protocols");
|
|
3481
3558
|
var import_bridge2 = require("@dxos/protocols/proto/dxos/mesh/bridge");
|
|
3482
3559
|
var import_util9 = require("@dxos/util");
|
|
3483
|
-
var __dxlog_file14 = "/
|
|
3560
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport-proxy.ts";
|
|
3484
3561
|
var SimplePeerTransportProxy = class {
|
|
3485
3562
|
constructor(_params) {
|
|
3486
3563
|
this._params = _params;
|
|
@@ -3660,7 +3737,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
3660
3737
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3661
3738
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3662
3739
|
}
|
|
3663
|
-
var __dxlog_file15 = "/
|
|
3740
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/libdatachannel-transport.ts";
|
|
3664
3741
|
var DATACHANNEL_LABEL = "dxos.mesh.transport";
|
|
3665
3742
|
var MAX_BUFFERED_AMOUNT = 64 * 1024;
|
|
3666
3743
|
var MAX_MESSAGE_SIZE = 64 * 1024;
|
|
@@ -3989,7 +4066,7 @@ var import_node_net = require("node:net");
|
|
|
3989
4066
|
var import_async12 = require("@dxos/async");
|
|
3990
4067
|
var import_debug8 = require("@dxos/debug");
|
|
3991
4068
|
var import_log15 = require("@dxos/log");
|
|
3992
|
-
var __dxlog_file16 = "/
|
|
4069
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/tcp-transport.ts";
|
|
3993
4070
|
var TcpTransportFactory = {
|
|
3994
4071
|
createTransport: (params) => new TcpTransport(params)
|
|
3995
4072
|
};
|