@dxos/network-manager 0.8.4-main.40e3dcdf1b → 0.8.4-main.422d1c7879
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-AQSYW43M.mjs → chunk-Y2FDDNGM.mjs} +185 -190
- package/dist/lib/browser/chunk-Y2FDDNGM.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 +14 -4
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{chunk-SCX3PZRE.mjs → chunk-OU3FYVBA.mjs} +185 -190
- package/dist/lib/node-esm/chunk-OU3FYVBA.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +14 -4
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/network-manager.d.ts +5 -4
- package/dist/types/src/network-manager.d.ts.map +1 -1
- package/dist/types/src/signal/signal-connection.d.ts +3 -2
- package/dist/types/src/signal/signal-connection.d.ts.map +1 -1
- package/dist/types/src/signal/signal-messenger.d.ts +3 -2
- package/dist/types/src/signal/signal-messenger.d.ts.map +1 -1
- package/dist/types/src/signal/swarm-messenger.d.ts +7 -7
- package/dist/types/src/signal/swarm-messenger.d.ts.map +1 -1
- package/dist/types/src/swarm/connection.d.ts +2 -1
- package/dist/types/src/swarm/connection.d.ts.map +1 -1
- package/dist/types/src/swarm/peer.d.ts +4 -3
- package/dist/types/src/swarm/peer.d.ts.map +1 -1
- package/dist/types/src/swarm/swarm.d.ts +3 -2
- package/dist/types/src/swarm/swarm.d.ts.map +1 -1
- package/dist/types/src/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/tests/basic-test-suite.d.ts.map +1 -1
- package/dist/types/src/tests/property-test-suite.d.ts.map +1 -1
- package/dist/types/src/transport/webrtc/rtc-peer-connection.d.ts.map +1 -1
- package/dist/types/src/transport/webrtc/rtc-transport-channel.d.ts.map +1 -1
- package/dist/types/src/transport/webrtc/rtc-transport-factory.d.ts.map +1 -1
- package/dist/types/src/transport/webrtc/rtc-transport-service.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -28
- package/src/network-manager.ts +19 -15
- package/src/signal/integration.node.test.ts +11 -10
- package/src/signal/signal-connection.ts +3 -2
- package/src/signal/signal-messenger.ts +3 -2
- package/src/signal/swarm-messenger.node.test.ts +25 -24
- package/src/signal/swarm-messenger.ts +65 -55
- package/src/swarm/connection.test.ts +6 -7
- package/src/swarm/connection.ts +5 -5
- package/src/swarm/peer.ts +5 -6
- package/src/swarm/swarm.test.ts +2 -3
- package/src/swarm/swarm.ts +9 -10
- package/src/testing/test-builder.ts +4 -4
- package/src/tests/basic-test-suite.ts +0 -1
- package/src/tests/memory-transport.test.ts +0 -2
- package/src/tests/property-test-suite.ts +4 -3
- package/src/tests/tcp-transport.node.test.ts +0 -2
- package/src/tests/webrtc-transport.test.ts +0 -1
- package/src/transport/webrtc/rtc-peer-connection.ts +0 -1
- package/src/transport/webrtc/rtc-transport-channel.test.ts +0 -2
- package/src/transport/webrtc/rtc-transport-channel.ts +0 -1
- package/src/transport/webrtc/rtc-transport-factory.ts +0 -1
- package/src/transport/webrtc/rtc-transport-proxy.test.ts +0 -2
- package/src/transport/webrtc/rtc-transport-service.ts +0 -1
- package/src/transport/webrtc/rtc-transport.test.ts +0 -1
- package/dist/lib/browser/chunk-AQSYW43M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SCX3PZRE.mjs.map +0 -7
|
@@ -60,7 +60,7 @@ var Connection = class {
|
|
|
60
60
|
_instanceId = PublicKey.random().toHex();
|
|
61
61
|
transportStats = new Event();
|
|
62
62
|
_signalSendTask = new DeferredTask(this._ctx, async () => {
|
|
63
|
-
await this._flushSignalBuffer();
|
|
63
|
+
await this._flushSignalBuffer(this._ctx);
|
|
64
64
|
});
|
|
65
65
|
_signallingDelay = STARTING_SIGNALLING_DELAY;
|
|
66
66
|
constructor(topic, localInfo, remoteInfo, sessionId, initiator, _signalMessaging, _protocol, _transportFactory, _callbacks) {
|
|
@@ -433,20 +433,20 @@ var Connection = class {
|
|
|
433
433
|
this._outgoingSignalBuffer.push(signal);
|
|
434
434
|
this._signalSendTask.schedule();
|
|
435
435
|
}
|
|
436
|
-
async _flushSignalBuffer() {
|
|
436
|
+
async _flushSignalBuffer(ctx) {
|
|
437
437
|
if (this._outgoingSignalBuffer.length === 0) {
|
|
438
438
|
return;
|
|
439
439
|
}
|
|
440
440
|
try {
|
|
441
441
|
if (true) {
|
|
442
|
-
await cancelWithContext(
|
|
442
|
+
await cancelWithContext(ctx, sleep(this._signallingDelay));
|
|
443
443
|
this._signallingDelay = Math.min(this._signallingDelay * 2, MAX_SIGNALLING_DELAY);
|
|
444
444
|
}
|
|
445
445
|
const signals = [
|
|
446
446
|
...this._outgoingSignalBuffer
|
|
447
447
|
];
|
|
448
448
|
this._outgoingSignalBuffer.length = 0;
|
|
449
|
-
await this._signalMessaging.signal({
|
|
449
|
+
await this._signalMessaging.signal(ctx, {
|
|
450
450
|
author: this.localInfo,
|
|
451
451
|
recipient: this.remoteInfo,
|
|
452
452
|
sessionId: this.sessionId,
|
|
@@ -480,7 +480,7 @@ var Connection = class {
|
|
|
480
480
|
/**
|
|
481
481
|
* Receive a signal from the remote peer.
|
|
482
482
|
*/
|
|
483
|
-
async signal(msg) {
|
|
483
|
+
async signal(_ctx, msg) {
|
|
484
484
|
invariant(msg.sessionId, void 0, {
|
|
485
485
|
F: __dxlog_file,
|
|
486
486
|
L: 410,
|
|
@@ -616,7 +616,6 @@ _ts_decorate([
|
|
|
616
616
|
], Connection.prototype, "close", null);
|
|
617
617
|
|
|
618
618
|
// src/signal/swarm-messenger.ts
|
|
619
|
-
import { Context as Context2 } from "@dxos/context";
|
|
620
619
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
621
620
|
import { PublicKey as PublicKey2 } from "@dxos/keys";
|
|
622
621
|
import { log as log2 } from "@dxos/log";
|
|
@@ -626,10 +625,6 @@ import { ComplexMap } from "@dxos/util";
|
|
|
626
625
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/core/mesh/network-manager/src/signal/swarm-messenger.ts";
|
|
627
626
|
var SwarmMessage = schema.getCodecForType("dxos.mesh.swarm.SwarmMessage");
|
|
628
627
|
var SwarmMessenger = class {
|
|
629
|
-
_ctx = new Context2(void 0, {
|
|
630
|
-
F: __dxlog_file2,
|
|
631
|
-
L: 35
|
|
632
|
-
});
|
|
633
628
|
_sendMessage;
|
|
634
629
|
_onSignal;
|
|
635
630
|
_onOffer;
|
|
@@ -641,7 +636,7 @@ var SwarmMessenger = class {
|
|
|
641
636
|
this._onOffer = onOffer;
|
|
642
637
|
this._topic = topic;
|
|
643
638
|
}
|
|
644
|
-
async receiveMessage({ author, recipient, payload }) {
|
|
639
|
+
async receiveMessage(ctx, { author, recipient, payload }) {
|
|
645
640
|
if (payload.type_url !== "dxos.mesh.swarm.SwarmMessage") {
|
|
646
641
|
return;
|
|
647
642
|
}
|
|
@@ -655,12 +650,12 @@ var SwarmMessenger = class {
|
|
|
655
650
|
msg: message
|
|
656
651
|
}, {
|
|
657
652
|
F: __dxlog_file2,
|
|
658
|
-
L:
|
|
653
|
+
L: 72,
|
|
659
654
|
S: this,
|
|
660
655
|
C: (f, a) => f(...a)
|
|
661
656
|
});
|
|
662
657
|
if (message.data?.offer) {
|
|
663
|
-
await this._handleOffer({
|
|
658
|
+
await this._handleOffer(ctx, {
|
|
664
659
|
author,
|
|
665
660
|
recipient,
|
|
666
661
|
message
|
|
@@ -668,13 +663,13 @@ var SwarmMessenger = class {
|
|
|
668
663
|
} else if (message.data?.answer) {
|
|
669
664
|
await this._resolveAnswers(message);
|
|
670
665
|
} else if (message.data?.signal) {
|
|
671
|
-
await this._handleSignal({
|
|
666
|
+
await this._handleSignal(ctx, {
|
|
672
667
|
author,
|
|
673
668
|
recipient,
|
|
674
669
|
message
|
|
675
670
|
});
|
|
676
671
|
} else if (message.data?.signalBatch) {
|
|
677
|
-
await this._handleSignal({
|
|
672
|
+
await this._handleSignal(ctx, {
|
|
678
673
|
author,
|
|
679
674
|
recipient,
|
|
680
675
|
message
|
|
@@ -684,29 +679,29 @@ var SwarmMessenger = class {
|
|
|
684
679
|
message
|
|
685
680
|
}, {
|
|
686
681
|
F: __dxlog_file2,
|
|
687
|
-
L:
|
|
682
|
+
L: 83,
|
|
688
683
|
S: this,
|
|
689
684
|
C: (f, a) => f(...a)
|
|
690
685
|
});
|
|
691
686
|
}
|
|
692
687
|
}
|
|
693
|
-
async signal(message) {
|
|
688
|
+
async signal(ctx, message) {
|
|
694
689
|
invariant2(message.data?.signal || message.data?.signalBatch, "Invalid message", {
|
|
695
690
|
F: __dxlog_file2,
|
|
696
|
-
L:
|
|
691
|
+
L: 88,
|
|
697
692
|
S: this,
|
|
698
693
|
A: [
|
|
699
694
|
"message.data?.signal || message.data?.signalBatch",
|
|
700
695
|
"'Invalid message'"
|
|
701
696
|
]
|
|
702
697
|
});
|
|
703
|
-
await this._sendReliableMessage({
|
|
698
|
+
await this._sendReliableMessage(ctx, {
|
|
704
699
|
author: message.author,
|
|
705
700
|
recipient: message.recipient,
|
|
706
701
|
message
|
|
707
702
|
});
|
|
708
703
|
}
|
|
709
|
-
async offer(message) {
|
|
704
|
+
async offer(ctx, message) {
|
|
710
705
|
const networkMessage = {
|
|
711
706
|
...message,
|
|
712
707
|
messageId: PublicKey2.random()
|
|
@@ -715,14 +710,14 @@ var SwarmMessenger = class {
|
|
|
715
710
|
this._offerRecords.set(networkMessage.messageId, {
|
|
716
711
|
resolve
|
|
717
712
|
});
|
|
718
|
-
this._sendReliableMessage({
|
|
713
|
+
this._sendReliableMessage(ctx, {
|
|
719
714
|
author: message.author,
|
|
720
715
|
recipient: message.recipient,
|
|
721
716
|
message: networkMessage
|
|
722
717
|
}).catch((err) => reject(err));
|
|
723
718
|
});
|
|
724
719
|
}
|
|
725
|
-
async _sendReliableMessage({ author, recipient, message }) {
|
|
720
|
+
async _sendReliableMessage(ctx, { author, recipient, message }) {
|
|
726
721
|
const networkMessage = {
|
|
727
722
|
...message,
|
|
728
723
|
// Setting unique message_id if it not specified yet.
|
|
@@ -734,11 +729,11 @@ var SwarmMessenger = class {
|
|
|
734
729
|
msg: networkMessage
|
|
735
730
|
}, {
|
|
736
731
|
F: __dxlog_file2,
|
|
737
|
-
L:
|
|
732
|
+
L: 129,
|
|
738
733
|
S: this,
|
|
739
734
|
C: (f, a) => f(...a)
|
|
740
735
|
});
|
|
741
|
-
await this._sendMessage({
|
|
736
|
+
await this._sendMessage(ctx, {
|
|
742
737
|
author,
|
|
743
738
|
recipient,
|
|
744
739
|
payload: {
|
|
@@ -750,7 +745,7 @@ var SwarmMessenger = class {
|
|
|
750
745
|
async _resolveAnswers(message) {
|
|
751
746
|
invariant2(message.data?.answer?.offerMessageId, "No offerMessageId", {
|
|
752
747
|
F: __dxlog_file2,
|
|
753
|
-
L:
|
|
748
|
+
L: 141,
|
|
754
749
|
S: this,
|
|
755
750
|
A: [
|
|
756
751
|
"message.data?.answer?.offerMessageId",
|
|
@@ -762,7 +757,7 @@ var SwarmMessenger = class {
|
|
|
762
757
|
this._offerRecords.delete(message.data.answer.offerMessageId);
|
|
763
758
|
invariant2(message.data?.answer, "No answer", {
|
|
764
759
|
F: __dxlog_file2,
|
|
765
|
-
L:
|
|
760
|
+
L: 145,
|
|
766
761
|
S: this,
|
|
767
762
|
A: [
|
|
768
763
|
"message.data?.answer",
|
|
@@ -773,17 +768,17 @@ var SwarmMessenger = class {
|
|
|
773
768
|
answer: message.data.answer
|
|
774
769
|
}, {
|
|
775
770
|
F: __dxlog_file2,
|
|
776
|
-
L:
|
|
771
|
+
L: 146,
|
|
777
772
|
S: this,
|
|
778
773
|
C: (f, a) => f(...a)
|
|
779
774
|
});
|
|
780
775
|
offerRecord.resolve(message.data.answer);
|
|
781
776
|
}
|
|
782
777
|
}
|
|
783
|
-
async _handleOffer({ author, recipient, message }) {
|
|
778
|
+
async _handleOffer(ctx, { author, recipient, message }) {
|
|
784
779
|
invariant2(message.data.offer, "No offer", {
|
|
785
780
|
F: __dxlog_file2,
|
|
786
|
-
L:
|
|
781
|
+
L: 163,
|
|
787
782
|
S: this,
|
|
788
783
|
A: [
|
|
789
784
|
"message.data.offer",
|
|
@@ -798,10 +793,10 @@ var SwarmMessenger = class {
|
|
|
798
793
|
offer: message.data.offer
|
|
799
794
|
}
|
|
800
795
|
};
|
|
801
|
-
const answer = await this._onOffer(offerMessage);
|
|
796
|
+
const answer = await this._onOffer(ctx, offerMessage);
|
|
802
797
|
answer.offerMessageId = message.messageId;
|
|
803
798
|
try {
|
|
804
|
-
await this._sendReliableMessage({
|
|
799
|
+
await this._sendReliableMessage(ctx, {
|
|
805
800
|
author: recipient,
|
|
806
801
|
recipient: author,
|
|
807
802
|
message: {
|
|
@@ -818,7 +813,7 @@ var SwarmMessenger = class {
|
|
|
818
813
|
err
|
|
819
814
|
}, {
|
|
820
815
|
F: __dxlog_file2,
|
|
821
|
-
L:
|
|
816
|
+
L: 184,
|
|
822
817
|
S: this,
|
|
823
818
|
C: (f, a) => f(...a)
|
|
824
819
|
});
|
|
@@ -827,17 +822,17 @@ var SwarmMessenger = class {
|
|
|
827
822
|
err
|
|
828
823
|
}, {
|
|
829
824
|
F: __dxlog_file2,
|
|
830
|
-
L:
|
|
825
|
+
L: 186,
|
|
831
826
|
S: this,
|
|
832
827
|
C: (f, a) => f(...a)
|
|
833
828
|
});
|
|
834
829
|
}
|
|
835
830
|
}
|
|
836
831
|
}
|
|
837
|
-
async _handleSignal({ author, recipient, message }) {
|
|
832
|
+
async _handleSignal(ctx, { author, recipient, message }) {
|
|
838
833
|
invariant2(message.messageId, void 0, {
|
|
839
834
|
F: __dxlog_file2,
|
|
840
|
-
L:
|
|
835
|
+
L: 203,
|
|
841
836
|
S: this,
|
|
842
837
|
A: [
|
|
843
838
|
"message.messageId",
|
|
@@ -846,7 +841,7 @@ var SwarmMessenger = class {
|
|
|
846
841
|
});
|
|
847
842
|
invariant2(message.data.signal || message.data.signalBatch, "Invalid message", {
|
|
848
843
|
F: __dxlog_file2,
|
|
849
|
-
L:
|
|
844
|
+
L: 204,
|
|
850
845
|
S: this,
|
|
851
846
|
A: [
|
|
852
847
|
"message.data.signal || message.data.signalBatch",
|
|
@@ -862,13 +857,13 @@ var SwarmMessenger = class {
|
|
|
862
857
|
signalBatch: message.data.signalBatch
|
|
863
858
|
}
|
|
864
859
|
};
|
|
865
|
-
await this._onSignal(signalMessage);
|
|
860
|
+
await this._onSignal(ctx, signalMessage);
|
|
866
861
|
}
|
|
867
862
|
};
|
|
868
863
|
|
|
869
864
|
// src/swarm/swarm.ts
|
|
870
865
|
import { Event as Event3, scheduleTask as scheduleTask3, sleep as sleep2, synchronized as synchronized3 } from "@dxos/async";
|
|
871
|
-
import { Context as
|
|
866
|
+
import { Context as Context3 } from "@dxos/context";
|
|
872
867
|
import { ErrorStream as ErrorStream2 } from "@dxos/debug";
|
|
873
868
|
import { invariant as invariant4 } from "@dxos/invariant";
|
|
874
869
|
import { PublicKey as PublicKey4 } from "@dxos/keys";
|
|
@@ -879,7 +874,7 @@ import { ComplexMap as ComplexMap2, isNonNullable } from "@dxos/util";
|
|
|
879
874
|
|
|
880
875
|
// src/swarm/peer.ts
|
|
881
876
|
import { Event as Event2, scheduleTask as scheduleTask2, synchronized as synchronized2 } from "@dxos/async";
|
|
882
|
-
import { Context as
|
|
877
|
+
import { Context as Context2 } from "@dxos/context";
|
|
883
878
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
884
879
|
import { PublicKey as PublicKey3 } from "@dxos/keys";
|
|
885
880
|
import { log as log3 } from "@dxos/log";
|
|
@@ -914,9 +909,9 @@ var Peer = class {
|
|
|
914
909
|
_availableAfter = 0;
|
|
915
910
|
availableToConnect = true;
|
|
916
911
|
_lastConnectionTime;
|
|
917
|
-
_ctx = new
|
|
912
|
+
_ctx = new Context2(void 0, {
|
|
918
913
|
F: __dxlog_file3,
|
|
919
|
-
L:
|
|
914
|
+
L: 80
|
|
920
915
|
});
|
|
921
916
|
_connectionCtx;
|
|
922
917
|
connection;
|
|
@@ -939,7 +934,7 @@ var Peer = class {
|
|
|
939
934
|
/**
|
|
940
935
|
* Respond to remote offer.
|
|
941
936
|
*/
|
|
942
|
-
async onOffer(message) {
|
|
937
|
+
async onOffer(_ctx, message) {
|
|
943
938
|
const remote = message.author;
|
|
944
939
|
if (this.connection && ![
|
|
945
940
|
ConnectionState.CREATED,
|
|
@@ -948,7 +943,7 @@ var Peer = class {
|
|
|
948
943
|
].includes(this.connection.state)) {
|
|
949
944
|
log3.info(`received offer when connection already in ${this.connection.state} state`, void 0, {
|
|
950
945
|
F: __dxlog_file3,
|
|
951
|
-
L:
|
|
946
|
+
L: 115,
|
|
952
947
|
S: this,
|
|
953
948
|
C: (f, a) => f(...a)
|
|
954
949
|
});
|
|
@@ -965,7 +960,7 @@ var Peer = class {
|
|
|
965
960
|
sessionId: this.connection?.sessionId
|
|
966
961
|
}, {
|
|
967
962
|
F: __dxlog_file3,
|
|
968
|
-
L:
|
|
963
|
+
L: 124,
|
|
969
964
|
S: this,
|
|
970
965
|
C: (f, a) => f(...a)
|
|
971
966
|
});
|
|
@@ -982,7 +977,7 @@ var Peer = class {
|
|
|
982
977
|
if (!this.connection) {
|
|
983
978
|
invariant3(message.sessionId, void 0, {
|
|
984
979
|
F: __dxlog_file3,
|
|
985
|
-
L:
|
|
980
|
+
L: 144,
|
|
986
981
|
S: this,
|
|
987
982
|
A: [
|
|
988
983
|
"message.sessionId",
|
|
@@ -1003,7 +998,7 @@ var Peer = class {
|
|
|
1003
998
|
err
|
|
1004
999
|
}, {
|
|
1005
1000
|
F: __dxlog_file3,
|
|
1006
|
-
L:
|
|
1001
|
+
L: 154,
|
|
1007
1002
|
S: this,
|
|
1008
1003
|
C: (f, a) => f(...a)
|
|
1009
1004
|
});
|
|
@@ -1022,10 +1017,10 @@ var Peer = class {
|
|
|
1022
1017
|
/**
|
|
1023
1018
|
* Initiate a connection to the remote peer.
|
|
1024
1019
|
*/
|
|
1025
|
-
async initiateConnection() {
|
|
1020
|
+
async initiateConnection(ctx) {
|
|
1026
1021
|
invariant3(!this.initiating, "Initiation in progress.", {
|
|
1027
1022
|
F: __dxlog_file3,
|
|
1028
|
-
L:
|
|
1023
|
+
L: 172,
|
|
1029
1024
|
S: this,
|
|
1030
1025
|
A: [
|
|
1031
1026
|
"!this.initiating",
|
|
@@ -1034,7 +1029,7 @@ var Peer = class {
|
|
|
1034
1029
|
});
|
|
1035
1030
|
invariant3(!this.connection, "Already connected.", {
|
|
1036
1031
|
F: __dxlog_file3,
|
|
1037
|
-
L:
|
|
1032
|
+
L: 173,
|
|
1038
1033
|
S: this,
|
|
1039
1034
|
A: [
|
|
1040
1035
|
"!this.connection",
|
|
@@ -1049,7 +1044,7 @@ var Peer = class {
|
|
|
1049
1044
|
sessionId
|
|
1050
1045
|
}, {
|
|
1051
1046
|
F: __dxlog_file3,
|
|
1052
|
-
L:
|
|
1047
|
+
L: 175,
|
|
1053
1048
|
S: this,
|
|
1054
1049
|
C: (f, a) => f(...a)
|
|
1055
1050
|
});
|
|
@@ -1059,7 +1054,7 @@ var Peer = class {
|
|
|
1059
1054
|
try {
|
|
1060
1055
|
await this._connectionLimiter.connecting(sessionId);
|
|
1061
1056
|
connection.initiate();
|
|
1062
|
-
answer = await this._signalMessaging.offer({
|
|
1057
|
+
answer = await this._signalMessaging.offer(ctx, {
|
|
1063
1058
|
author: this.localInfo,
|
|
1064
1059
|
recipient: this.remoteInfo,
|
|
1065
1060
|
sessionId,
|
|
@@ -1075,14 +1070,14 @@ var Peer = class {
|
|
|
1075
1070
|
remote: this.remoteInfo
|
|
1076
1071
|
}, {
|
|
1077
1072
|
F: __dxlog_file3,
|
|
1078
|
-
L:
|
|
1073
|
+
L: 192,
|
|
1079
1074
|
S: this,
|
|
1080
1075
|
C: (f, a) => f(...a)
|
|
1081
1076
|
});
|
|
1082
1077
|
if (connection.state !== ConnectionState.INITIAL) {
|
|
1083
1078
|
log3("ignoring response", void 0, {
|
|
1084
1079
|
F: __dxlog_file3,
|
|
1085
|
-
L:
|
|
1080
|
+
L: 194,
|
|
1086
1081
|
S: this,
|
|
1087
1082
|
C: (f, a) => f(...a)
|
|
1088
1083
|
});
|
|
@@ -1096,7 +1091,7 @@ var Peer = class {
|
|
|
1096
1091
|
remote: this.remoteInfo
|
|
1097
1092
|
}, {
|
|
1098
1093
|
F: __dxlog_file3,
|
|
1099
|
-
L:
|
|
1094
|
+
L: 198,
|
|
1100
1095
|
S: this,
|
|
1101
1096
|
C: (f, a) => f(...a)
|
|
1102
1097
|
});
|
|
@@ -1118,7 +1113,7 @@ var Peer = class {
|
|
|
1118
1113
|
remote: this.remoteInfo
|
|
1119
1114
|
}, {
|
|
1120
1115
|
F: __dxlog_file3,
|
|
1121
|
-
L:
|
|
1116
|
+
L: 211,
|
|
1122
1117
|
S: this,
|
|
1123
1118
|
C: (f, a) => f(...a)
|
|
1124
1119
|
});
|
|
@@ -1130,7 +1125,7 @@ var Peer = class {
|
|
|
1130
1125
|
try {
|
|
1131
1126
|
log3("opening connection as initiator", void 0, {
|
|
1132
1127
|
F: __dxlog_file3,
|
|
1133
|
-
L:
|
|
1128
|
+
L: 224,
|
|
1134
1129
|
S: this,
|
|
1135
1130
|
C: (f, a) => f(...a)
|
|
1136
1131
|
});
|
|
@@ -1144,7 +1139,7 @@ var Peer = class {
|
|
|
1144
1139
|
remote: this.remoteInfo
|
|
1145
1140
|
}, {
|
|
1146
1141
|
F: __dxlog_file3,
|
|
1147
|
-
L:
|
|
1142
|
+
L: 228,
|
|
1148
1143
|
S: this,
|
|
1149
1144
|
C: (f, a) => f(...a)
|
|
1150
1145
|
});
|
|
@@ -1152,7 +1147,7 @@ var Peer = class {
|
|
|
1152
1147
|
err
|
|
1153
1148
|
}, {
|
|
1154
1149
|
F: __dxlog_file3,
|
|
1155
|
-
L:
|
|
1150
|
+
L: 235,
|
|
1156
1151
|
S: this,
|
|
1157
1152
|
C: (f, a) => f(...a)
|
|
1158
1153
|
});
|
|
@@ -1175,13 +1170,13 @@ var Peer = class {
|
|
|
1175
1170
|
sessionId
|
|
1176
1171
|
}, {
|
|
1177
1172
|
F: __dxlog_file3,
|
|
1178
|
-
L:
|
|
1173
|
+
L: 249,
|
|
1179
1174
|
S: this,
|
|
1180
1175
|
C: (f, a) => f(...a)
|
|
1181
1176
|
});
|
|
1182
1177
|
invariant3(!this.connection, "Already connected.", {
|
|
1183
1178
|
F: __dxlog_file3,
|
|
1184
|
-
L:
|
|
1179
|
+
L: 256,
|
|
1185
1180
|
S: this,
|
|
1186
1181
|
A: [
|
|
1187
1182
|
"!this.connection",
|
|
@@ -1217,7 +1212,7 @@ var Peer = class {
|
|
|
1217
1212
|
initiator
|
|
1218
1213
|
}, {
|
|
1219
1214
|
F: __dxlog_file3,
|
|
1220
|
-
L:
|
|
1215
|
+
L: 280,
|
|
1221
1216
|
S: this,
|
|
1222
1217
|
C: (f, a) => f(...a)
|
|
1223
1218
|
});
|
|
@@ -1231,14 +1226,14 @@ var Peer = class {
|
|
|
1231
1226
|
};
|
|
1232
1227
|
log3("connection closed", logMeta, {
|
|
1233
1228
|
F: __dxlog_file3,
|
|
1234
|
-
L:
|
|
1229
|
+
L: 290,
|
|
1235
1230
|
S: this,
|
|
1236
1231
|
C: (f, a) => f(...a)
|
|
1237
1232
|
});
|
|
1238
1233
|
this._connectionLimiter.doneConnecting(sessionId);
|
|
1239
1234
|
invariant3(this.connection === connection, "Connection mismatch (race condition).", {
|
|
1240
1235
|
F: __dxlog_file3,
|
|
1241
|
-
L:
|
|
1236
|
+
L: 295,
|
|
1242
1237
|
S: this,
|
|
1243
1238
|
A: [
|
|
1244
1239
|
"this.connection === connection",
|
|
@@ -1253,7 +1248,7 @@ var Peer = class {
|
|
|
1253
1248
|
initiator
|
|
1254
1249
|
}, {
|
|
1255
1250
|
F: __dxlog_file3,
|
|
1256
|
-
L:
|
|
1251
|
+
L: 297,
|
|
1257
1252
|
S: this,
|
|
1258
1253
|
C: (f, a) => f(...a)
|
|
1259
1254
|
});
|
|
@@ -1270,7 +1265,7 @@ var Peer = class {
|
|
|
1270
1265
|
scheduleTask2(this._connectionCtx, () => {
|
|
1271
1266
|
log3("peer became available", logMeta, {
|
|
1272
1267
|
F: __dxlog_file3,
|
|
1273
|
-
L:
|
|
1268
|
+
L: 321,
|
|
1274
1269
|
S: this,
|
|
1275
1270
|
C: (f, a) => f(...a)
|
|
1276
1271
|
});
|
|
@@ -1294,7 +1289,7 @@ var Peer = class {
|
|
|
1294
1289
|
err
|
|
1295
1290
|
}, {
|
|
1296
1291
|
F: __dxlog_file3,
|
|
1297
|
-
L:
|
|
1292
|
+
L: 339,
|
|
1298
1293
|
S: this,
|
|
1299
1294
|
C: (f, a) => f(...a)
|
|
1300
1295
|
});
|
|
@@ -1307,7 +1302,7 @@ var Peer = class {
|
|
|
1307
1302
|
err
|
|
1308
1303
|
}, {
|
|
1309
1304
|
F: __dxlog_file3,
|
|
1310
|
-
L:
|
|
1305
|
+
L: 346,
|
|
1311
1306
|
S: this,
|
|
1312
1307
|
C: (f, a) => f(...a)
|
|
1313
1308
|
});
|
|
@@ -1326,7 +1321,7 @@ var Peer = class {
|
|
|
1326
1321
|
sessionId: connection.sessionId
|
|
1327
1322
|
}, {
|
|
1328
1323
|
F: __dxlog_file3,
|
|
1329
|
-
L:
|
|
1324
|
+
L: 371,
|
|
1330
1325
|
S: this,
|
|
1331
1326
|
C: (f, a) => f(...a)
|
|
1332
1327
|
});
|
|
@@ -1338,24 +1333,24 @@ var Peer = class {
|
|
|
1338
1333
|
sessionId: connection.sessionId
|
|
1339
1334
|
}, {
|
|
1340
1335
|
F: __dxlog_file3,
|
|
1341
|
-
L:
|
|
1336
|
+
L: 377,
|
|
1342
1337
|
S: this,
|
|
1343
1338
|
C: (f, a) => f(...a)
|
|
1344
1339
|
});
|
|
1345
1340
|
}
|
|
1346
|
-
async onSignal(message) {
|
|
1341
|
+
async onSignal(ctx, message) {
|
|
1347
1342
|
if (!this.connection) {
|
|
1348
1343
|
log3("dropping signal message for non-existent connection", {
|
|
1349
1344
|
message
|
|
1350
1345
|
}, {
|
|
1351
1346
|
F: __dxlog_file3,
|
|
1352
|
-
L:
|
|
1347
|
+
L: 382,
|
|
1353
1348
|
S: this,
|
|
1354
1349
|
C: (f, a) => f(...a)
|
|
1355
1350
|
});
|
|
1356
1351
|
return;
|
|
1357
1352
|
}
|
|
1358
|
-
await this.connection.signal(message);
|
|
1353
|
+
await this.connection.signal(ctx, message);
|
|
1359
1354
|
}
|
|
1360
1355
|
async safeDestroy(reason) {
|
|
1361
1356
|
await this._ctx.dispose();
|
|
@@ -1364,7 +1359,7 @@ var Peer = class {
|
|
|
1364
1359
|
topic: this.topic
|
|
1365
1360
|
}, {
|
|
1366
1361
|
F: __dxlog_file3,
|
|
1367
|
-
L:
|
|
1362
|
+
L: 392,
|
|
1368
1363
|
S: this,
|
|
1369
1364
|
C: (f, a) => f(...a)
|
|
1370
1365
|
});
|
|
@@ -1410,9 +1405,9 @@ var Swarm = class {
|
|
|
1410
1405
|
_connectionLimiter;
|
|
1411
1406
|
_initiationDelay;
|
|
1412
1407
|
_swarmMessenger;
|
|
1413
|
-
_ctx = new
|
|
1408
|
+
_ctx = new Context3(void 0, {
|
|
1414
1409
|
F: __dxlog_file4,
|
|
1415
|
-
L:
|
|
1410
|
+
L: 38
|
|
1416
1411
|
});
|
|
1417
1412
|
_listeningHandle = void 0;
|
|
1418
1413
|
/**
|
|
@@ -1460,7 +1455,7 @@ var Swarm = class {
|
|
|
1460
1455
|
}
|
|
1461
1456
|
}), {
|
|
1462
1457
|
F: __dxlog_file4,
|
|
1463
|
-
L:
|
|
1458
|
+
L: 88,
|
|
1464
1459
|
S: this,
|
|
1465
1460
|
C: (f, a) => f(...a)
|
|
1466
1461
|
});
|
|
@@ -1468,22 +1463,22 @@ var Swarm = class {
|
|
|
1468
1463
|
peerId: _ownPeer
|
|
1469
1464
|
}, {
|
|
1470
1465
|
F: __dxlog_file4,
|
|
1471
|
-
L:
|
|
1466
|
+
L: 92,
|
|
1472
1467
|
S: this,
|
|
1473
1468
|
C: (f, a) => f(...a)
|
|
1474
1469
|
});
|
|
1475
1470
|
_topology.init(this._getSwarmController());
|
|
1476
1471
|
this._swarmMessenger = new SwarmMessenger({
|
|
1477
|
-
sendMessage: async (msg) => await this._messenger.sendMessage(msg),
|
|
1478
|
-
onSignal: async (msg) => await this.onSignal(msg),
|
|
1479
|
-
onOffer: async (msg) => await this.onOffer(msg),
|
|
1472
|
+
sendMessage: async (ctx, msg) => await this._messenger.sendMessage(ctx, msg),
|
|
1473
|
+
onSignal: async (ctx, msg) => await this.onSignal(ctx, msg),
|
|
1474
|
+
onOffer: async (ctx, msg) => await this.onOffer(ctx, msg),
|
|
1480
1475
|
topic: this._topic
|
|
1481
1476
|
});
|
|
1482
1477
|
log4.trace("dxos.mesh.swarm.constructor", trace2.end({
|
|
1483
1478
|
id: this._instanceId
|
|
1484
1479
|
}), {
|
|
1485
1480
|
F: __dxlog_file4,
|
|
1486
|
-
L:
|
|
1481
|
+
L: 101,
|
|
1487
1482
|
S: this,
|
|
1488
1483
|
C: (f, a) => f(...a)
|
|
1489
1484
|
});
|
|
@@ -1509,7 +1504,7 @@ var Swarm = class {
|
|
|
1509
1504
|
async open() {
|
|
1510
1505
|
invariant4(!this._listeningHandle, void 0, {
|
|
1511
1506
|
F: __dxlog_file4,
|
|
1512
|
-
L:
|
|
1507
|
+
L: 132,
|
|
1513
1508
|
S: this,
|
|
1514
1509
|
A: [
|
|
1515
1510
|
"!this._listeningHandle",
|
|
@@ -1520,11 +1515,11 @@ var Swarm = class {
|
|
|
1520
1515
|
peer: this._ownPeer,
|
|
1521
1516
|
payloadType: "dxos.mesh.swarm.SwarmMessage",
|
|
1522
1517
|
onMessage: async (message) => {
|
|
1523
|
-
await this._swarmMessenger.receiveMessage(message).catch((err) => log4.info("Error while receiving message", {
|
|
1518
|
+
await this._swarmMessenger.receiveMessage(this._ctx, message).catch((err) => log4.info("Error while receiving message", {
|
|
1524
1519
|
err
|
|
1525
1520
|
}, {
|
|
1526
1521
|
F: __dxlog_file4,
|
|
1527
|
-
L:
|
|
1522
|
+
L: 140,
|
|
1528
1523
|
S: this,
|
|
1529
1524
|
C: (f, a) => f(...a)
|
|
1530
1525
|
}));
|
|
@@ -1534,7 +1529,7 @@ var Swarm = class {
|
|
|
1534
1529
|
async destroy() {
|
|
1535
1530
|
log4("destroying...", void 0, {
|
|
1536
1531
|
F: __dxlog_file4,
|
|
1537
|
-
L:
|
|
1532
|
+
L: 146,
|
|
1538
1533
|
S: this,
|
|
1539
1534
|
C: (f, a) => f(...a)
|
|
1540
1535
|
});
|
|
@@ -1545,7 +1540,7 @@ var Swarm = class {
|
|
|
1545
1540
|
await Promise.all(Array.from(this._peers.keys()).map((key) => this._destroyPeer(key, "swarm destroyed")));
|
|
1546
1541
|
log4("destroyed", void 0, {
|
|
1547
1542
|
F: __dxlog_file4,
|
|
1548
|
-
L:
|
|
1543
|
+
L: 153,
|
|
1549
1544
|
S: this,
|
|
1550
1545
|
C: (f, a) => f(...a)
|
|
1551
1546
|
});
|
|
@@ -1553,7 +1548,7 @@ var Swarm = class {
|
|
|
1553
1548
|
async setTopology(topology) {
|
|
1554
1549
|
invariant4(!this._ctx.disposed, "Swarm is offline", {
|
|
1555
1550
|
F: __dxlog_file4,
|
|
1556
|
-
L:
|
|
1551
|
+
L: 157,
|
|
1557
1552
|
S: this,
|
|
1558
1553
|
A: [
|
|
1559
1554
|
"!this._ctx.disposed",
|
|
@@ -1568,7 +1563,7 @@ var Swarm = class {
|
|
|
1568
1563
|
topology: getClassName(topology)
|
|
1569
1564
|
}, {
|
|
1570
1565
|
F: __dxlog_file4,
|
|
1571
|
-
L:
|
|
1566
|
+
L: 161,
|
|
1572
1567
|
S: this,
|
|
1573
1568
|
C: (f, a) => f(...a)
|
|
1574
1569
|
});
|
|
@@ -1582,14 +1577,14 @@ var Swarm = class {
|
|
|
1582
1577
|
swarmEvent
|
|
1583
1578
|
}, {
|
|
1584
1579
|
F: __dxlog_file4,
|
|
1585
|
-
L:
|
|
1580
|
+
L: 174,
|
|
1586
1581
|
S: this,
|
|
1587
1582
|
C: (f, a) => f(...a)
|
|
1588
1583
|
});
|
|
1589
1584
|
if (this._ctx.disposed) {
|
|
1590
1585
|
log4("swarm event ignored for disposed swarm", void 0, {
|
|
1591
1586
|
F: __dxlog_file4,
|
|
1592
|
-
L:
|
|
1587
|
+
L: 177,
|
|
1593
1588
|
S: this,
|
|
1594
1589
|
C: (f, a) => f(...a)
|
|
1595
1590
|
});
|
|
@@ -1602,7 +1597,7 @@ var Swarm = class {
|
|
|
1602
1597
|
peerId
|
|
1603
1598
|
}, {
|
|
1604
1599
|
F: __dxlog_file4,
|
|
1605
|
-
L:
|
|
1600
|
+
L: 184,
|
|
1606
1601
|
S: this,
|
|
1607
1602
|
C: (f, a) => f(...a)
|
|
1608
1603
|
});
|
|
@@ -1616,13 +1611,13 @@ var Swarm = class {
|
|
|
1616
1611
|
if (this._isConnectionEstablishmentInProgress(peer)) {
|
|
1617
1612
|
log4(`destroying peer, state: ${peer.connection?.state}`, void 0, {
|
|
1618
1613
|
F: __dxlog_file4,
|
|
1619
|
-
L:
|
|
1614
|
+
L: 195,
|
|
1620
1615
|
S: this,
|
|
1621
1616
|
C: (f, a) => f(...a)
|
|
1622
1617
|
});
|
|
1623
1618
|
void this._destroyPeer(swarmEvent.peerLeft.peer, "peer left").catch((err) => log4.catch(err, void 0, {
|
|
1624
1619
|
F: __dxlog_file4,
|
|
1625
|
-
L:
|
|
1620
|
+
L: 196,
|
|
1626
1621
|
S: this,
|
|
1627
1622
|
C: (f, a) => f(...a)
|
|
1628
1623
|
}));
|
|
@@ -1632,7 +1627,7 @@ var Swarm = class {
|
|
|
1632
1627
|
peer: swarmEvent.peerLeft.peer.peerKey
|
|
1633
1628
|
}, {
|
|
1634
1629
|
F: __dxlog_file4,
|
|
1635
|
-
L:
|
|
1630
|
+
L: 199,
|
|
1636
1631
|
S: this,
|
|
1637
1632
|
C: (f, a) => f(...a)
|
|
1638
1633
|
});
|
|
@@ -1640,19 +1635,19 @@ var Swarm = class {
|
|
|
1640
1635
|
}
|
|
1641
1636
|
this._topology.update();
|
|
1642
1637
|
}
|
|
1643
|
-
async onOffer(message) {
|
|
1638
|
+
async onOffer(ctx, message) {
|
|
1644
1639
|
log4("offer", {
|
|
1645
1640
|
message
|
|
1646
1641
|
}, {
|
|
1647
1642
|
F: __dxlog_file4,
|
|
1648
|
-
L:
|
|
1643
|
+
L: 208,
|
|
1649
1644
|
S: this,
|
|
1650
1645
|
C: (f, a) => f(...a)
|
|
1651
1646
|
});
|
|
1652
1647
|
if (this._ctx.disposed) {
|
|
1653
1648
|
log4("ignored for disposed swarm", void 0, {
|
|
1654
1649
|
F: __dxlog_file4,
|
|
1655
|
-
L:
|
|
1650
|
+
L: 210,
|
|
1656
1651
|
S: this,
|
|
1657
1652
|
C: (f, a) => f(...a)
|
|
1658
1653
|
});
|
|
@@ -1662,7 +1657,7 @@ var Swarm = class {
|
|
|
1662
1657
|
}
|
|
1663
1658
|
invariant4(message.author, void 0, {
|
|
1664
1659
|
F: __dxlog_file4,
|
|
1665
|
-
L:
|
|
1660
|
+
L: 215,
|
|
1666
1661
|
S: this,
|
|
1667
1662
|
A: [
|
|
1668
1663
|
"message.author",
|
|
@@ -1674,7 +1669,7 @@ var Swarm = class {
|
|
|
1674
1669
|
message
|
|
1675
1670
|
}, {
|
|
1676
1671
|
F: __dxlog_file4,
|
|
1677
|
-
L:
|
|
1672
|
+
L: 217,
|
|
1678
1673
|
S: this,
|
|
1679
1674
|
C: (f, a) => f(...a)
|
|
1680
1675
|
});
|
|
@@ -1687,7 +1682,7 @@ var Swarm = class {
|
|
|
1687
1682
|
message
|
|
1688
1683
|
}, {
|
|
1689
1684
|
F: __dxlog_file4,
|
|
1690
|
-
L:
|
|
1685
|
+
L: 221,
|
|
1691
1686
|
S: this,
|
|
1692
1687
|
C: (f, a) => f(...a)
|
|
1693
1688
|
});
|
|
@@ -1696,7 +1691,7 @@ var Swarm = class {
|
|
|
1696
1691
|
};
|
|
1697
1692
|
}
|
|
1698
1693
|
const peer = this._getOfferSenderPeer(message.author);
|
|
1699
|
-
const answer = await peer.onOffer(message);
|
|
1694
|
+
const answer = await peer.onOffer(ctx, message);
|
|
1700
1695
|
this._topology.update();
|
|
1701
1696
|
return answer;
|
|
1702
1697
|
}
|
|
@@ -1710,19 +1705,19 @@ var Swarm = class {
|
|
|
1710
1705
|
}
|
|
1711
1706
|
return peer;
|
|
1712
1707
|
}
|
|
1713
|
-
async onSignal(message) {
|
|
1708
|
+
async onSignal(ctx, message) {
|
|
1714
1709
|
log4("signal", {
|
|
1715
1710
|
message
|
|
1716
1711
|
}, {
|
|
1717
1712
|
F: __dxlog_file4,
|
|
1718
|
-
L:
|
|
1713
|
+
L: 246,
|
|
1719
1714
|
S: this,
|
|
1720
1715
|
C: (f, a) => f(...a)
|
|
1721
1716
|
});
|
|
1722
1717
|
if (this._ctx.disposed) {
|
|
1723
1718
|
log4.info("ignored for offline swarm", void 0, {
|
|
1724
1719
|
F: __dxlog_file4,
|
|
1725
|
-
L:
|
|
1720
|
+
L: 248,
|
|
1726
1721
|
S: this,
|
|
1727
1722
|
C: (f, a) => f(...a)
|
|
1728
1723
|
});
|
|
@@ -1730,7 +1725,7 @@ var Swarm = class {
|
|
|
1730
1725
|
}
|
|
1731
1726
|
invariant4(message.recipient.peerKey === this._ownPeer.peerKey, `Invalid signal peer id expected=${this.ownPeerId}, actual=${message.recipient}`, {
|
|
1732
1727
|
F: __dxlog_file4,
|
|
1733
|
-
L:
|
|
1728
|
+
L: 251,
|
|
1734
1729
|
S: this,
|
|
1735
1730
|
A: [
|
|
1736
1731
|
"message.recipient.peerKey === this._ownPeer.peerKey",
|
|
@@ -1739,7 +1734,7 @@ var Swarm = class {
|
|
|
1739
1734
|
});
|
|
1740
1735
|
invariant4(message.topic?.equals(this._topic), void 0, {
|
|
1741
1736
|
F: __dxlog_file4,
|
|
1742
|
-
L:
|
|
1737
|
+
L: 255,
|
|
1743
1738
|
S: this,
|
|
1744
1739
|
A: [
|
|
1745
1740
|
"message.topic?.equals(this._topic)",
|
|
@@ -1748,7 +1743,7 @@ var Swarm = class {
|
|
|
1748
1743
|
});
|
|
1749
1744
|
invariant4(message.author, void 0, {
|
|
1750
1745
|
F: __dxlog_file4,
|
|
1751
|
-
L:
|
|
1746
|
+
L: 256,
|
|
1752
1747
|
S: this,
|
|
1753
1748
|
A: [
|
|
1754
1749
|
"message.author",
|
|
@@ -1756,7 +1751,7 @@ var Swarm = class {
|
|
|
1756
1751
|
]
|
|
1757
1752
|
});
|
|
1758
1753
|
const peer = this._getOrCreatePeer(message.author);
|
|
1759
|
-
await peer.onSignal(message);
|
|
1754
|
+
await peer.onSignal(ctx, message);
|
|
1760
1755
|
}
|
|
1761
1756
|
// For debug purposes
|
|
1762
1757
|
async goOffline() {
|
|
@@ -1767,15 +1762,15 @@ var Swarm = class {
|
|
|
1767
1762
|
}
|
|
1768
1763
|
// For debug purposes
|
|
1769
1764
|
async goOnline() {
|
|
1770
|
-
this._ctx = new
|
|
1765
|
+
this._ctx = new Context3(void 0, {
|
|
1771
1766
|
F: __dxlog_file4,
|
|
1772
|
-
L:
|
|
1767
|
+
L: 272
|
|
1773
1768
|
});
|
|
1774
1769
|
}
|
|
1775
1770
|
_getOrCreatePeer(peerInfo) {
|
|
1776
1771
|
invariant4(peerInfo.peerKey, "PeerInfo.peerKey is required", {
|
|
1777
1772
|
F: __dxlog_file4,
|
|
1778
|
-
L:
|
|
1773
|
+
L: 276,
|
|
1779
1774
|
S: this,
|
|
1780
1775
|
A: [
|
|
1781
1776
|
"peerInfo.peerKey",
|
|
@@ -1795,7 +1790,7 @@ var Swarm = class {
|
|
|
1795
1790
|
if (this._isUnregistered(peer)) {
|
|
1796
1791
|
log4.verbose("ignored onDisconnected for unregistered peer", void 0, {
|
|
1797
1792
|
F: __dxlog_file4,
|
|
1798
|
-
L:
|
|
1793
|
+
L: 296,
|
|
1799
1794
|
S: this,
|
|
1800
1795
|
C: (f, a) => f(...a)
|
|
1801
1796
|
});
|
|
@@ -1813,7 +1808,7 @@ var Swarm = class {
|
|
|
1813
1808
|
peerInfo
|
|
1814
1809
|
}, {
|
|
1815
1810
|
F: __dxlog_file4,
|
|
1816
|
-
L:
|
|
1811
|
+
L: 310,
|
|
1817
1812
|
S: this,
|
|
1818
1813
|
C: (f, a) => f(...a)
|
|
1819
1814
|
});
|
|
@@ -1840,14 +1835,14 @@ var Swarm = class {
|
|
|
1840
1835
|
reason
|
|
1841
1836
|
}, {
|
|
1842
1837
|
F: __dxlog_file4,
|
|
1843
|
-
L:
|
|
1838
|
+
L: 332,
|
|
1844
1839
|
S: this,
|
|
1845
1840
|
C: (f, a) => f(...a)
|
|
1846
1841
|
});
|
|
1847
1842
|
const peer = this._peers.get(peerInfo);
|
|
1848
1843
|
invariant4(peer, void 0, {
|
|
1849
1844
|
F: __dxlog_file4,
|
|
1850
|
-
L:
|
|
1845
|
+
L: 334,
|
|
1851
1846
|
S: this,
|
|
1852
1847
|
A: [
|
|
1853
1848
|
"peer",
|
|
@@ -1877,7 +1872,7 @@ var Swarm = class {
|
|
|
1877
1872
|
} catch (err) {
|
|
1878
1873
|
log4("initiation error", err, {
|
|
1879
1874
|
F: __dxlog_file4,
|
|
1880
|
-
L:
|
|
1875
|
+
L: 361,
|
|
1881
1876
|
S: this,
|
|
1882
1877
|
C: (f, a) => f(...a)
|
|
1883
1878
|
});
|
|
@@ -1908,7 +1903,7 @@ var Swarm = class {
|
|
|
1908
1903
|
remotePeer
|
|
1909
1904
|
}, {
|
|
1910
1905
|
F: __dxlog_file4,
|
|
1911
|
-
L:
|
|
1906
|
+
L: 389,
|
|
1912
1907
|
S: this,
|
|
1913
1908
|
C: (f, a) => f(...a)
|
|
1914
1909
|
});
|
|
@@ -1927,17 +1922,17 @@ var Swarm = class {
|
|
|
1927
1922
|
remotePeer
|
|
1928
1923
|
}, {
|
|
1929
1924
|
F: __dxlog_file4,
|
|
1930
|
-
L:
|
|
1925
|
+
L: 405,
|
|
1931
1926
|
S: this,
|
|
1932
1927
|
C: (f, a) => f(...a)
|
|
1933
1928
|
});
|
|
1934
|
-
await peer.initiateConnection();
|
|
1929
|
+
await peer.initiateConnection(ctx);
|
|
1935
1930
|
this._topology.update();
|
|
1936
1931
|
log4("initiated", {
|
|
1937
1932
|
remotePeer
|
|
1938
1933
|
}, {
|
|
1939
1934
|
F: __dxlog_file4,
|
|
1940
|
-
L:
|
|
1935
|
+
L: 408,
|
|
1941
1936
|
S: this,
|
|
1942
1937
|
C: (f, a) => f(...a)
|
|
1943
1938
|
});
|
|
@@ -2059,7 +2054,7 @@ var SwarmMapper = class {
|
|
|
2059
2054
|
|
|
2060
2055
|
// src/swarm/connection-limiter.ts
|
|
2061
2056
|
import { DeferredTask as DeferredTask2 } from "@dxos/async";
|
|
2062
|
-
import { Context as
|
|
2057
|
+
import { Context as Context4 } from "@dxos/context";
|
|
2063
2058
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
2064
2059
|
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
2065
2060
|
import { log as log6 } from "@dxos/log";
|
|
@@ -2068,7 +2063,7 @@ import { ComplexMap as ComplexMap4 } from "@dxos/util";
|
|
|
2068
2063
|
var __dxlog_file6 = "/__w/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection-limiter.ts";
|
|
2069
2064
|
var MAX_CONCURRENT_INITIATING_CONNECTIONS = 50;
|
|
2070
2065
|
var ConnectionLimiter = class {
|
|
2071
|
-
_ctx = new
|
|
2066
|
+
_ctx = new Context4(void 0, {
|
|
2072
2067
|
F: __dxlog_file6,
|
|
2073
2068
|
L: 23
|
|
2074
2069
|
});
|
|
@@ -2274,8 +2269,8 @@ var SwarmNetworkManager = class {
|
|
|
2274
2269
|
signalManager: this._signalManager
|
|
2275
2270
|
});
|
|
2276
2271
|
this._signalConnection = {
|
|
2277
|
-
join: (opts) => this._signalManager.join(opts),
|
|
2278
|
-
leave: (opts) => this._signalManager.leave(opts)
|
|
2272
|
+
join: (ctx, opts) => this._signalManager.join(ctx, opts),
|
|
2273
|
+
leave: (ctx, opts) => this._signalManager.leave(ctx, opts)
|
|
2279
2274
|
};
|
|
2280
2275
|
this._peerInfo = peerInfo;
|
|
2281
2276
|
this._connectionLimiter = new ConnectionLimiter();
|
|
@@ -2308,7 +2303,7 @@ var SwarmNetworkManager = class {
|
|
|
2308
2303
|
id: this._instanceId
|
|
2309
2304
|
}), {
|
|
2310
2305
|
F: __dxlog_file7,
|
|
2311
|
-
L:
|
|
2306
|
+
L: 134,
|
|
2312
2307
|
S: this,
|
|
2313
2308
|
C: (f, a) => f(...a)
|
|
2314
2309
|
});
|
|
@@ -2318,17 +2313,17 @@ var SwarmNetworkManager = class {
|
|
|
2318
2313
|
id: this._instanceId
|
|
2319
2314
|
}), {
|
|
2320
2315
|
F: __dxlog_file7,
|
|
2321
|
-
L:
|
|
2316
|
+
L: 137,
|
|
2322
2317
|
S: this,
|
|
2323
2318
|
C: (f, a) => f(...a)
|
|
2324
2319
|
});
|
|
2325
2320
|
}
|
|
2326
|
-
async close() {
|
|
2321
|
+
async close(ctx) {
|
|
2327
2322
|
for (const topic of this._swarms.keys()) {
|
|
2328
|
-
await this.leaveSwarm(topic).catch((err) => {
|
|
2323
|
+
await this.leaveSwarm(ctx, topic).catch((err) => {
|
|
2329
2324
|
log7(err, void 0, {
|
|
2330
2325
|
F: __dxlog_file7,
|
|
2331
|
-
L:
|
|
2326
|
+
L: 143,
|
|
2332
2327
|
S: this,
|
|
2333
2328
|
C: (f, a) => f(...a)
|
|
2334
2329
|
});
|
|
@@ -2340,10 +2335,10 @@ var SwarmNetworkManager = class {
|
|
|
2340
2335
|
/**
|
|
2341
2336
|
* Join the swarm.
|
|
2342
2337
|
*/
|
|
2343
|
-
async joinSwarm({ topic, topology, protocolProvider: protocol, label }) {
|
|
2338
|
+
async joinSwarm(ctx, { topic, topology, protocolProvider: protocol, label }) {
|
|
2344
2339
|
invariant6(PublicKey8.isPublicKey(topic), void 0, {
|
|
2345
2340
|
F: __dxlog_file7,
|
|
2346
|
-
L:
|
|
2341
|
+
L: 164,
|
|
2347
2342
|
S: this,
|
|
2348
2343
|
A: [
|
|
2349
2344
|
"PublicKey.isPublicKey(topic)",
|
|
@@ -2352,7 +2347,7 @@ var SwarmNetworkManager = class {
|
|
|
2352
2347
|
});
|
|
2353
2348
|
invariant6(topology, void 0, {
|
|
2354
2349
|
F: __dxlog_file7,
|
|
2355
|
-
L:
|
|
2350
|
+
L: 165,
|
|
2356
2351
|
S: this,
|
|
2357
2352
|
A: [
|
|
2358
2353
|
"topology",
|
|
@@ -2361,7 +2356,7 @@ var SwarmNetworkManager = class {
|
|
|
2361
2356
|
});
|
|
2362
2357
|
invariant6(this._peerInfo, void 0, {
|
|
2363
2358
|
F: __dxlog_file7,
|
|
2364
|
-
L:
|
|
2359
|
+
L: 166,
|
|
2365
2360
|
S: this,
|
|
2366
2361
|
A: [
|
|
2367
2362
|
"this._peerInfo",
|
|
@@ -2370,7 +2365,7 @@ var SwarmNetworkManager = class {
|
|
|
2370
2365
|
});
|
|
2371
2366
|
invariant6(typeof protocol === "function", void 0, {
|
|
2372
2367
|
F: __dxlog_file7,
|
|
2373
|
-
L:
|
|
2368
|
+
L: 167,
|
|
2374
2369
|
S: this,
|
|
2375
2370
|
A: [
|
|
2376
2371
|
"typeof protocol === 'function'",
|
|
@@ -2386,7 +2381,7 @@ var SwarmNetworkManager = class {
|
|
|
2386
2381
|
topology: topology.toString()
|
|
2387
2382
|
}, {
|
|
2388
2383
|
F: __dxlog_file7,
|
|
2389
|
-
L:
|
|
2384
|
+
L: 172,
|
|
2390
2385
|
S: this,
|
|
2391
2386
|
C: (f, a) => f(...a)
|
|
2392
2387
|
});
|
|
@@ -2396,7 +2391,7 @@ var SwarmNetworkManager = class {
|
|
|
2396
2391
|
error
|
|
2397
2392
|
}, {
|
|
2398
2393
|
F: __dxlog_file7,
|
|
2399
|
-
L:
|
|
2394
|
+
L: 185,
|
|
2400
2395
|
S: this,
|
|
2401
2396
|
C: (f, a) => f(...a)
|
|
2402
2397
|
});
|
|
@@ -2404,12 +2399,12 @@ var SwarmNetworkManager = class {
|
|
|
2404
2399
|
this._swarms.set(topic, swarm);
|
|
2405
2400
|
this._mappers.set(topic, new SwarmMapper(swarm));
|
|
2406
2401
|
await swarm.open();
|
|
2407
|
-
this._signalConnection.join({
|
|
2402
|
+
this._signalConnection.join(ctx, {
|
|
2408
2403
|
topic,
|
|
2409
2404
|
peer: this._peerInfo
|
|
2410
2405
|
}).catch((error) => log7.catch(error, void 0, {
|
|
2411
2406
|
F: __dxlog_file7,
|
|
2412
|
-
L:
|
|
2407
|
+
L: 194,
|
|
2413
2408
|
S: this,
|
|
2414
2409
|
C: (f, a) => f(...a)
|
|
2415
2410
|
}));
|
|
@@ -2420,18 +2415,18 @@ var SwarmNetworkManager = class {
|
|
|
2420
2415
|
count: this._swarms.size
|
|
2421
2416
|
}, {
|
|
2422
2417
|
F: __dxlog_file7,
|
|
2423
|
-
L:
|
|
2418
|
+
L: 198,
|
|
2424
2419
|
S: this,
|
|
2425
2420
|
C: (f, a) => f(...a)
|
|
2426
2421
|
});
|
|
2427
2422
|
return {
|
|
2428
|
-
close: () => this.leaveSwarm(topic)
|
|
2423
|
+
close: (ctx2) => this.leaveSwarm(ctx2, topic)
|
|
2429
2424
|
};
|
|
2430
2425
|
}
|
|
2431
2426
|
/**
|
|
2432
2427
|
* Close the connection.
|
|
2433
2428
|
*/
|
|
2434
|
-
async leaveSwarm(topic) {
|
|
2429
|
+
async leaveSwarm(ctx, topic) {
|
|
2435
2430
|
if (!this._swarms.has(topic)) {
|
|
2436
2431
|
return;
|
|
2437
2432
|
}
|
|
@@ -2439,12 +2434,12 @@ var SwarmNetworkManager = class {
|
|
|
2439
2434
|
topic: PublicKey8.from(topic)
|
|
2440
2435
|
}, {
|
|
2441
2436
|
F: __dxlog_file7,
|
|
2442
|
-
L:
|
|
2437
|
+
L: 215,
|
|
2443
2438
|
S: this,
|
|
2444
2439
|
C: (f, a) => f(...a)
|
|
2445
2440
|
});
|
|
2446
2441
|
const swarm = this._swarms.get(topic);
|
|
2447
|
-
await this._signalConnection.leave({
|
|
2442
|
+
await this._signalConnection.leave(ctx, {
|
|
2448
2443
|
topic,
|
|
2449
2444
|
peer: swarm.ownPeer
|
|
2450
2445
|
});
|
|
@@ -2460,7 +2455,7 @@ var SwarmNetworkManager = class {
|
|
|
2460
2455
|
count: this._swarms.size
|
|
2461
2456
|
}, {
|
|
2462
2457
|
F: __dxlog_file7,
|
|
2463
|
-
L:
|
|
2458
|
+
L: 229,
|
|
2464
2459
|
S: this,
|
|
2465
2460
|
C: (f, a) => f(...a)
|
|
2466
2461
|
});
|
|
@@ -2879,7 +2874,7 @@ var RtcTransportChannel = class extends Resource {
|
|
|
2879
2874
|
async _open() {
|
|
2880
2875
|
invariant9(!this._isChannelCreationInProgress, void 0, {
|
|
2881
2876
|
F: __dxlog_file10,
|
|
2882
|
-
L:
|
|
2877
|
+
L: 56,
|
|
2883
2878
|
S: this,
|
|
2884
2879
|
A: [
|
|
2885
2880
|
"!this._isChannelCreationInProgress",
|
|
@@ -2905,7 +2900,7 @@ var RtcTransportChannel = class extends Resource {
|
|
|
2905
2900
|
err
|
|
2906
2901
|
}, {
|
|
2907
2902
|
F: __dxlog_file10,
|
|
2908
|
-
L:
|
|
2903
|
+
L: 76,
|
|
2909
2904
|
S: this,
|
|
2910
2905
|
C: (f, a) => f(...a)
|
|
2911
2906
|
});
|
|
@@ -2923,7 +2918,7 @@ var RtcTransportChannel = class extends Resource {
|
|
|
2923
2918
|
this.closed.emit();
|
|
2924
2919
|
log9("closed", void 0, {
|
|
2925
2920
|
F: __dxlog_file10,
|
|
2926
|
-
L:
|
|
2921
|
+
L: 92,
|
|
2927
2922
|
S: this,
|
|
2928
2923
|
C: (f, a) => f(...a)
|
|
2929
2924
|
});
|
|
@@ -2936,7 +2931,7 @@ var RtcTransportChannel = class extends Resource {
|
|
|
2936
2931
|
topic: this._options.topic
|
|
2937
2932
|
}, {
|
|
2938
2933
|
F: __dxlog_file10,
|
|
2939
|
-
L:
|
|
2934
|
+
L: 99,
|
|
2940
2935
|
S: this,
|
|
2941
2936
|
C: (f, a) => f(...a)
|
|
2942
2937
|
});
|
|
@@ -2945,7 +2940,7 @@ var RtcTransportChannel = class extends Resource {
|
|
|
2945
2940
|
}
|
|
2946
2941
|
log9("onopen", void 0, {
|
|
2947
2942
|
F: __dxlog_file10,
|
|
2948
|
-
L:
|
|
2943
|
+
L: 104,
|
|
2949
2944
|
S: this,
|
|
2950
2945
|
C: (f, a) => f(...a)
|
|
2951
2946
|
});
|
|
@@ -2963,7 +2958,7 @@ var RtcTransportChannel = class extends Resource {
|
|
|
2963
2958
|
onclose: async () => {
|
|
2964
2959
|
log9("onclose", void 0, {
|
|
2965
2960
|
F: __dxlog_file10,
|
|
2966
|
-
L:
|
|
2961
|
+
L: 117,
|
|
2967
2962
|
S: this,
|
|
2968
2963
|
C: (f, a) => f(...a)
|
|
2969
2964
|
});
|
|
@@ -2973,7 +2968,7 @@ var RtcTransportChannel = class extends Resource {
|
|
|
2973
2968
|
if (!this._stream) {
|
|
2974
2969
|
log9.warn("ignoring message on a closed channel", void 0, {
|
|
2975
2970
|
F: __dxlog_file10,
|
|
2976
|
-
L:
|
|
2971
|
+
L: 123,
|
|
2977
2972
|
S: this,
|
|
2978
2973
|
C: (f, a) => f(...a)
|
|
2979
2974
|
});
|
|
@@ -3004,7 +2999,7 @@ var RtcTransportChannel = class extends Resource {
|
|
|
3004
2999
|
if (!this._channel) {
|
|
3005
3000
|
log9.warn("writing to a channel after a connection was closed", void 0, {
|
|
3006
3001
|
F: __dxlog_file10,
|
|
3007
|
-
L:
|
|
3002
|
+
L: 153,
|
|
3008
3003
|
S: this,
|
|
3009
3004
|
C: (f, a) => f(...a)
|
|
3010
3005
|
});
|
|
@@ -3027,7 +3022,7 @@ var RtcTransportChannel = class extends Resource {
|
|
|
3027
3022
|
if (this._streamDataFlushedCallback !== null) {
|
|
3028
3023
|
log9.error("consumer trying to write before we are ready for more data", void 0, {
|
|
3029
3024
|
F: __dxlog_file10,
|
|
3030
|
-
L:
|
|
3025
|
+
L: 174,
|
|
3031
3026
|
S: this,
|
|
3032
3027
|
C: (f, a) => f(...a)
|
|
3033
3028
|
});
|
|
@@ -3043,7 +3038,7 @@ var RtcTransportChannel = class extends Resource {
|
|
|
3043
3038
|
} catch (error) {
|
|
3044
3039
|
log9.catch(error, void 0, {
|
|
3045
3040
|
F: __dxlog_file10,
|
|
3046
|
-
L:
|
|
3041
|
+
L: 186,
|
|
3047
3042
|
S: this,
|
|
3048
3043
|
C: (f, a) => f(...a)
|
|
3049
3044
|
});
|
|
@@ -3143,7 +3138,7 @@ var RtcPeerConnection = class {
|
|
|
3143
3138
|
}
|
|
3144
3139
|
log10("waiting for initiator-peer to open a data channel", void 0, {
|
|
3145
3140
|
F: __dxlog_file11,
|
|
3146
|
-
L:
|
|
3141
|
+
L: 95,
|
|
3147
3142
|
S: this,
|
|
3148
3143
|
C: (f, a) => f(...a)
|
|
3149
3144
|
});
|
|
@@ -3174,7 +3169,7 @@ var RtcPeerConnection = class {
|
|
|
3174
3169
|
remotePeer: this._options.remotePeerKey
|
|
3175
3170
|
}), {
|
|
3176
3171
|
F: __dxlog_file11,
|
|
3177
|
-
L:
|
|
3172
|
+
L: 120,
|
|
3178
3173
|
S: this,
|
|
3179
3174
|
C: (f, a) => f(...a)
|
|
3180
3175
|
});
|
|
@@ -3185,7 +3180,7 @@ var RtcPeerConnection = class {
|
|
|
3185
3180
|
onnegotiationneeded: async () => {
|
|
3186
3181
|
invariant10(this._initiator, void 0, {
|
|
3187
3182
|
F: __dxlog_file11,
|
|
3188
|
-
L:
|
|
3183
|
+
L: 135,
|
|
3189
3184
|
S: this,
|
|
3190
3185
|
A: [
|
|
3191
3186
|
"this._initiator",
|
|
@@ -3198,7 +3193,7 @@ var RtcPeerConnection = class {
|
|
|
3198
3193
|
}
|
|
3199
3194
|
log10("onnegotiationneeded", void 0, {
|
|
3200
3195
|
F: __dxlog_file11,
|
|
3201
|
-
L:
|
|
3196
|
+
L: 142,
|
|
3202
3197
|
S: this,
|
|
3203
3198
|
C: (f, a) => f(...a)
|
|
3204
3199
|
});
|
|
@@ -3222,7 +3217,7 @@ var RtcPeerConnection = class {
|
|
|
3222
3217
|
candidate: event.candidate.candidate
|
|
3223
3218
|
}, {
|
|
3224
3219
|
F: __dxlog_file11,
|
|
3225
|
-
L:
|
|
3220
|
+
L: 161,
|
|
3226
3221
|
S: this,
|
|
3227
3222
|
C: (f, a) => f(...a)
|
|
3228
3223
|
});
|
|
@@ -3230,7 +3225,7 @@ var RtcPeerConnection = class {
|
|
|
3230
3225
|
} else {
|
|
3231
3226
|
log10("onicecandidate gathering complete", void 0, {
|
|
3232
3227
|
F: __dxlog_file11,
|
|
3233
|
-
L:
|
|
3228
|
+
L: 164,
|
|
3234
3229
|
S: this,
|
|
3235
3230
|
C: (f, a) => f(...a)
|
|
3236
3231
|
});
|
|
@@ -3258,7 +3253,7 @@ var RtcPeerConnection = class {
|
|
|
3258
3253
|
state: connection.iceConnectionState
|
|
3259
3254
|
}, {
|
|
3260
3255
|
F: __dxlog_file11,
|
|
3261
|
-
L:
|
|
3256
|
+
L: 184,
|
|
3262
3257
|
S: this,
|
|
3263
3258
|
C: (f, a) => f(...a)
|
|
3264
3259
|
});
|
|
@@ -3280,7 +3275,7 @@ var RtcPeerConnection = class {
|
|
|
3280
3275
|
state: connection.connectionState
|
|
3281
3276
|
}, {
|
|
3282
3277
|
F: __dxlog_file11,
|
|
3283
|
-
L:
|
|
3278
|
+
L: 201,
|
|
3284
3279
|
S: this,
|
|
3285
3280
|
C: (f, a) => f(...a)
|
|
3286
3281
|
});
|
|
@@ -3293,7 +3288,7 @@ var RtcPeerConnection = class {
|
|
|
3293
3288
|
state: connection.signalingState
|
|
3294
3289
|
}, {
|
|
3295
3290
|
F: __dxlog_file11,
|
|
3296
|
-
L:
|
|
3291
|
+
L: 208,
|
|
3297
3292
|
S: this,
|
|
3298
3293
|
C: (f, a) => f(...a)
|
|
3299
3294
|
});
|
|
@@ -3303,7 +3298,7 @@ var RtcPeerConnection = class {
|
|
|
3303
3298
|
ondatachannel: (event) => {
|
|
3304
3299
|
invariant10(!this._initiator, "Initiator is expected to create data channels.", {
|
|
3305
3300
|
F: __dxlog_file11,
|
|
3306
|
-
L:
|
|
3301
|
+
L: 214,
|
|
3307
3302
|
S: this,
|
|
3308
3303
|
A: [
|
|
3309
3304
|
"!this._initiator",
|
|
@@ -3318,7 +3313,7 @@ var RtcPeerConnection = class {
|
|
|
3318
3313
|
label: event.channel.label
|
|
3319
3314
|
}, {
|
|
3320
3315
|
F: __dxlog_file11,
|
|
3321
|
-
L:
|
|
3316
|
+
L: 221,
|
|
3322
3317
|
S: this,
|
|
3323
3318
|
C: (f, a) => f(...a)
|
|
3324
3319
|
});
|
|
@@ -3346,7 +3341,7 @@ var RtcPeerConnection = class {
|
|
|
3346
3341
|
error
|
|
3347
3342
|
}, {
|
|
3348
3343
|
F: __dxlog_file11,
|
|
3349
|
-
L:
|
|
3344
|
+
L: 246,
|
|
3350
3345
|
S: this,
|
|
3351
3346
|
C: (f, a) => f(...a)
|
|
3352
3347
|
});
|
|
@@ -3367,7 +3362,7 @@ var RtcPeerConnection = class {
|
|
|
3367
3362
|
reason: error.message
|
|
3368
3363
|
}, {
|
|
3369
3364
|
F: __dxlog_file11,
|
|
3370
|
-
L:
|
|
3365
|
+
L: 260,
|
|
3371
3366
|
S: this,
|
|
3372
3367
|
C: (f, a) => f(...a)
|
|
3373
3368
|
});
|
|
@@ -3375,7 +3370,7 @@ var RtcPeerConnection = class {
|
|
|
3375
3370
|
async _lockAndCloseConnection() {
|
|
3376
3371
|
invariant10(this._transportChannels.size === 0, void 0, {
|
|
3377
3372
|
F: __dxlog_file11,
|
|
3378
|
-
L:
|
|
3373
|
+
L: 265,
|
|
3379
3374
|
S: this,
|
|
3380
3375
|
A: [
|
|
3381
3376
|
"this._transportChannels.size === 0",
|
|
@@ -3386,7 +3381,7 @@ var RtcPeerConnection = class {
|
|
|
3386
3381
|
this._safeCloseConnection();
|
|
3387
3382
|
log10("connection closed", void 0, {
|
|
3388
3383
|
F: __dxlog_file11,
|
|
3389
|
-
L:
|
|
3384
|
+
L: 268,
|
|
3390
3385
|
S: this,
|
|
3391
3386
|
C: (f, a) => f(...a)
|
|
3392
3387
|
});
|
|
@@ -3399,7 +3394,7 @@ var RtcPeerConnection = class {
|
|
|
3399
3394
|
type: signal.payload.data.type
|
|
3400
3395
|
}, {
|
|
3401
3396
|
F: __dxlog_file11,
|
|
3402
|
-
L:
|
|
3397
|
+
L: 276,
|
|
3403
3398
|
S: this,
|
|
3404
3399
|
C: (f, a) => f(...a)
|
|
3405
3400
|
});
|
|
@@ -3466,7 +3461,7 @@ var RtcPeerConnection = class {
|
|
|
3466
3461
|
type: data.type
|
|
3467
3462
|
}, {
|
|
3468
3463
|
F: __dxlog_file11,
|
|
3469
|
-
L:
|
|
3464
|
+
L: 335,
|
|
3470
3465
|
S: this,
|
|
3471
3466
|
C: (f, a) => f(...a)
|
|
3472
3467
|
});
|
|
@@ -3479,7 +3474,7 @@ var RtcPeerConnection = class {
|
|
|
3479
3474
|
candidate
|
|
3480
3475
|
}, {
|
|
3481
3476
|
F: __dxlog_file11,
|
|
3482
|
-
L:
|
|
3477
|
+
L: 343,
|
|
3483
3478
|
S: this,
|
|
3484
3479
|
C: (f, a) => f(...a)
|
|
3485
3480
|
});
|
|
@@ -3488,7 +3483,7 @@ var RtcPeerConnection = class {
|
|
|
3488
3483
|
} catch (err) {
|
|
3489
3484
|
log10.catch(err, void 0, {
|
|
3490
3485
|
F: __dxlog_file11,
|
|
3491
|
-
L:
|
|
3486
|
+
L: 347,
|
|
3492
3487
|
S: this,
|
|
3493
3488
|
C: (f, a) => f(...a)
|
|
3494
3489
|
});
|
|
@@ -3498,7 +3493,7 @@ var RtcPeerConnection = class {
|
|
|
3498
3493
|
if (connection === this._connection) {
|
|
3499
3494
|
log10("ready to process ice candidates", void 0, {
|
|
3500
3495
|
F: __dxlog_file11,
|
|
3501
|
-
L:
|
|
3496
|
+
L: 353,
|
|
3502
3497
|
S: this,
|
|
3503
3498
|
C: (f, a) => f(...a)
|
|
3504
3499
|
});
|
|
@@ -3506,7 +3501,7 @@ var RtcPeerConnection = class {
|
|
|
3506
3501
|
} else {
|
|
3507
3502
|
log10.warn("session was negotiated after connection became inactive", void 0, {
|
|
3508
3503
|
F: __dxlog_file11,
|
|
3509
|
-
L:
|
|
3504
|
+
L: 356,
|
|
3510
3505
|
S: this,
|
|
3511
3506
|
C: (f, a) => f(...a)
|
|
3512
3507
|
});
|
|
@@ -3518,7 +3513,7 @@ var RtcPeerConnection = class {
|
|
|
3518
3513
|
state: connection.connectionState
|
|
3519
3514
|
}, {
|
|
3520
3515
|
F: __dxlog_file11,
|
|
3521
|
-
L:
|
|
3516
|
+
L: 361,
|
|
3522
3517
|
S: this,
|
|
3523
3518
|
C: (f, a) => f(...a)
|
|
3524
3519
|
});
|
|
@@ -3531,7 +3526,7 @@ var RtcPeerConnection = class {
|
|
|
3531
3526
|
} catch (err) {
|
|
3532
3527
|
log10.catch(err, void 0, {
|
|
3533
3528
|
F: __dxlog_file11,
|
|
3534
|
-
L:
|
|
3529
|
+
L: 373,
|
|
3535
3530
|
S: this,
|
|
3536
3531
|
C: (f, a) => f(...a)
|
|
3537
3532
|
});
|
|
@@ -3542,7 +3537,7 @@ var RtcPeerConnection = class {
|
|
|
3542
3537
|
this._readyForCandidates.wake();
|
|
3543
3538
|
void this._factory.onConnectionDestroyed().catch((err) => log10.catch(err, void 0, {
|
|
3544
3539
|
F: __dxlog_file11,
|
|
3545
|
-
L:
|
|
3540
|
+
L: 379,
|
|
3546
3541
|
S: this,
|
|
3547
3542
|
C: (f, a) => f(...a)
|
|
3548
3543
|
}));
|
|
@@ -3567,7 +3562,7 @@ var RtcPeerConnection = class {
|
|
|
3567
3562
|
} catch (error) {
|
|
3568
3563
|
log10.catch(error, void 0, {
|
|
3569
3564
|
F: __dxlog_file11,
|
|
3570
|
-
L:
|
|
3565
|
+
L: 395,
|
|
3571
3566
|
S: this,
|
|
3572
3567
|
C: (f, a) => f(...a)
|
|
3573
3568
|
});
|
|
@@ -3594,7 +3589,7 @@ var RtcPeerConnection = class {
|
|
|
3594
3589
|
err
|
|
3595
3590
|
}, {
|
|
3596
3591
|
F: __dxlog_file11,
|
|
3597
|
-
L:
|
|
3592
|
+
L: 416,
|
|
3598
3593
|
S: this,
|
|
3599
3594
|
C: (f, a) => f(...a)
|
|
3600
3595
|
});
|
|
@@ -4005,7 +4000,7 @@ var RtcTransportService = class {
|
|
|
4005
4000
|
if (existingTransport) {
|
|
4006
4001
|
log12.error("requesting a new transport bridge for an existing proxy", void 0, {
|
|
4007
4002
|
F: __dxlog_file13,
|
|
4008
|
-
L:
|
|
4003
|
+
L: 53,
|
|
4009
4004
|
S: this,
|
|
4010
4005
|
C: (f, a) => f(...a)
|
|
4011
4006
|
});
|
|
@@ -4071,7 +4066,7 @@ var RtcTransportService = class {
|
|
|
4071
4066
|
ready();
|
|
4072
4067
|
log12("stream ready", void 0, {
|
|
4073
4068
|
F: __dxlog_file13,
|
|
4074
|
-
L:
|
|
4069
|
+
L: 115,
|
|
4075
4070
|
S: this,
|
|
4076
4071
|
C: (f, a) => f(...a)
|
|
4077
4072
|
});
|
|
@@ -4082,7 +4077,7 @@ var RtcTransportService = class {
|
|
|
4082
4077
|
const transport = this._openTransports.get(proxyId);
|
|
4083
4078
|
invariant12(transport, void 0, {
|
|
4084
4079
|
F: __dxlog_file13,
|
|
4085
|
-
L:
|
|
4080
|
+
L: 123,
|
|
4086
4081
|
S: this,
|
|
4087
4082
|
A: [
|
|
4088
4083
|
"transport",
|
|
@@ -4095,7 +4090,7 @@ var RtcTransportService = class {
|
|
|
4095
4090
|
const transport = this._openTransports.get(proxyId);
|
|
4096
4091
|
invariant12(transport, void 0, {
|
|
4097
4092
|
F: __dxlog_file13,
|
|
4098
|
-
L:
|
|
4093
|
+
L: 130,
|
|
4099
4094
|
S: this,
|
|
4100
4095
|
A: [
|
|
4101
4096
|
"transport",
|
|
@@ -4110,7 +4105,7 @@ var RtcTransportService = class {
|
|
|
4110
4105
|
const transport = this._openTransports.get(proxyId);
|
|
4111
4106
|
invariant12(transport, void 0, {
|
|
4112
4107
|
F: __dxlog_file13,
|
|
4113
|
-
L:
|
|
4108
|
+
L: 137,
|
|
4114
4109
|
S: this,
|
|
4115
4110
|
A: [
|
|
4116
4111
|
"transport",
|
|
@@ -4125,7 +4120,7 @@ var RtcTransportService = class {
|
|
|
4125
4120
|
const transport = this._openTransports.get(proxyId);
|
|
4126
4121
|
invariant12(transport, void 0, {
|
|
4127
4122
|
F: __dxlog_file13,
|
|
4128
|
-
L:
|
|
4123
|
+
L: 144,
|
|
4129
4124
|
S: this,
|
|
4130
4125
|
A: [
|
|
4131
4126
|
"transport",
|
|
@@ -4159,7 +4154,7 @@ var RtcTransportService = class {
|
|
|
4159
4154
|
message: error?.message
|
|
4160
4155
|
}, {
|
|
4161
4156
|
F: __dxlog_file13,
|
|
4162
|
-
L:
|
|
4157
|
+
L: 174,
|
|
4163
4158
|
S: this,
|
|
4164
4159
|
C: (f, a) => f(...a)
|
|
4165
4160
|
});
|
|
@@ -4171,14 +4166,14 @@ var RtcTransportService = class {
|
|
|
4171
4166
|
message: error?.message
|
|
4172
4167
|
}, {
|
|
4173
4168
|
F: __dxlog_file13,
|
|
4174
|
-
L:
|
|
4169
|
+
L: 179,
|
|
4175
4170
|
S: this,
|
|
4176
4171
|
C: (f, a) => f(...a)
|
|
4177
4172
|
});
|
|
4178
4173
|
}
|
|
4179
4174
|
log12("closed", void 0, {
|
|
4180
4175
|
F: __dxlog_file13,
|
|
4181
|
-
L:
|
|
4176
|
+
L: 181,
|
|
4182
4177
|
S: this,
|
|
4183
4178
|
C: (f, a) => f(...a)
|
|
4184
4179
|
});
|
|
@@ -4242,4 +4237,4 @@ export {
|
|
|
4242
4237
|
RtcTransportService,
|
|
4243
4238
|
createTeleportProtocolFactory
|
|
4244
4239
|
};
|
|
4245
|
-
//# sourceMappingURL=chunk-
|
|
4240
|
+
//# sourceMappingURL=chunk-Y2FDDNGM.mjs.map
|