@streamr/dht 100.0.0-pretestnet.6 → 100.0.0-rc.0
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/README.md +90 -8
- package/dist/package.json +70 -0
- package/dist/src/connection/Connection.d.ts +1 -0
- package/dist/src/connection/Connection.js +10 -3
- package/dist/src/connection/Connection.js.map +1 -1
- package/dist/src/connection/ConnectionLockHandler.d.ts +14 -14
- package/dist/src/connection/ConnectionLockHandler.js +22 -16
- package/dist/src/connection/ConnectionLockHandler.js.map +1 -1
- package/dist/src/connection/ConnectionLockRpcLocal.d.ts +3 -3
- package/dist/src/connection/ConnectionLockRpcLocal.js +7 -6
- package/dist/src/connection/ConnectionLockRpcLocal.js.map +1 -1
- package/dist/src/connection/ConnectionLockRpcRemote.d.ts +4 -6
- package/dist/src/connection/ConnectionLockRpcRemote.js +10 -37
- package/dist/src/connection/ConnectionLockRpcRemote.js.map +1 -1
- package/dist/src/connection/ConnectionManager.d.ts +19 -20
- package/dist/src/connection/ConnectionManager.js +132 -117
- package/dist/src/connection/ConnectionManager.js.map +1 -1
- package/dist/src/connection/ConnectorFacade.d.ts +3 -2
- package/dist/src/connection/ConnectorFacade.js +10 -3
- package/dist/src/connection/ConnectorFacade.js.map +1 -1
- package/dist/src/connection/Handshaker.d.ts +3 -1
- package/dist/src/connection/Handshaker.js +18 -9
- package/dist/src/connection/Handshaker.js.map +1 -1
- package/dist/src/connection/IConnection.d.ts +2 -7
- package/dist/src/connection/IConnection.js +1 -8
- package/dist/src/connection/IConnection.js.map +1 -1
- package/dist/src/connection/ManagedConnection.d.ts +5 -7
- package/dist/src/connection/ManagedConnection.js +42 -26
- package/dist/src/connection/ManagedConnection.js.map +1 -1
- package/dist/src/connection/ManagedWebrtcConnection.js.map +1 -1
- package/dist/src/connection/connectivityChecker.d.ts +9 -0
- package/dist/src/connection/connectivityChecker.js +130 -0
- package/dist/src/connection/connectivityChecker.js.map +1 -0
- package/dist/src/connection/connectivityRequestHandler.d.ts +3 -0
- package/dist/src/connection/connectivityRequestHandler.js +101 -0
- package/dist/src/connection/connectivityRequestHandler.js.map +1 -0
- package/dist/src/connection/simulator/Simulator.d.ts +0 -3
- package/dist/src/connection/simulator/Simulator.js +34 -69
- package/dist/src/connection/simulator/Simulator.js.map +1 -1
- package/dist/src/connection/simulator/SimulatorConnection.js +27 -25
- package/dist/src/connection/simulator/SimulatorConnection.js.map +1 -1
- package/dist/src/connection/simulator/SimulatorConnector.js +16 -12
- package/dist/src/connection/simulator/SimulatorConnector.js.map +1 -1
- package/dist/src/connection/simulator/pings.js.map +1 -1
- package/dist/src/connection/webrtc/NodeWebrtcConnection.d.ts +2 -3
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js +40 -27
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnector.d.ts +0 -2
- package/dist/src/connection/webrtc/WebrtcConnector.js +24 -25
- package/dist/src/connection/webrtc/WebrtcConnector.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.d.ts +2 -2
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js +27 -20
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.d.ts +3 -6
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js +2 -5
- package/dist/src/connection/webrtc/WebrtcConnectorRpcRemote.js.map +1 -1
- package/dist/src/connection/webrtc/iceServerAsString.js +1 -1
- package/dist/src/connection/webrtc/iceServerAsString.js.map +1 -1
- package/dist/src/connection/websocket/AutoCertifierClientFacade.d.ts +1 -2
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js +6 -4
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js.map +1 -1
- package/dist/src/connection/websocket/ClientWebsocket.d.ts +1 -0
- package/dist/src/connection/websocket/ClientWebsocket.js +14 -7
- package/dist/src/connection/websocket/ClientWebsocket.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketConnector.d.ts +3 -9
- package/dist/src/connection/websocket/WebsocketConnector.js +142 -74
- package/dist/src/connection/websocket/WebsocketConnector.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.d.ts +5 -3
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js +9 -12
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.d.ts +4 -7
- package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.js +7 -44
- package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketServer.d.ts +1 -4
- package/dist/src/connection/websocket/WebsocketServer.js +49 -40
- package/dist/src/connection/websocket/WebsocketServer.js.map +1 -1
- package/dist/src/connection/websocket/{ServerWebsocket.d.ts → WebsocketServerConnection.d.ts} +8 -4
- package/dist/src/connection/websocket/WebsocketServerConnection.js +97 -0
- package/dist/src/connection/websocket/WebsocketServerConnection.js.map +1 -0
- package/dist/src/dht/DhtNode.d.ts +45 -49
- package/dist/src/dht/DhtNode.js +229 -317
- package/dist/src/dht/DhtNode.js.map +1 -1
- package/dist/src/dht/DhtNodeRpcLocal.d.ts +10 -9
- package/dist/src/dht/DhtNodeRpcLocal.js +19 -11
- package/dist/src/dht/DhtNodeRpcLocal.js.map +1 -1
- package/dist/src/dht/DhtNodeRpcRemote.d.ts +15 -10
- package/dist/src/dht/DhtNodeRpcRemote.js +38 -21
- package/dist/src/dht/DhtNodeRpcRemote.js.map +1 -1
- package/dist/src/dht/ExternalApiRpcLocal.d.ts +7 -6
- package/dist/src/dht/ExternalApiRpcLocal.js +9 -13
- package/dist/src/dht/ExternalApiRpcLocal.js.map +1 -1
- package/dist/src/dht/ExternalApiRpcRemote.d.ts +6 -5
- package/dist/src/dht/ExternalApiRpcRemote.js +10 -7
- package/dist/src/dht/ExternalApiRpcRemote.js.map +1 -1
- package/dist/src/dht/PeerManager.d.ts +61 -0
- package/dist/src/dht/PeerManager.js +288 -0
- package/dist/src/dht/PeerManager.js.map +1 -0
- package/dist/src/dht/contact/Contact.d.ts +2 -2
- package/dist/src/dht/contact/Contact.js +4 -3
- package/dist/src/dht/contact/Contact.js.map +1 -1
- package/dist/src/dht/contact/ContactList.d.ts +8 -8
- package/dist/src/dht/contact/ContactList.js +12 -7
- package/dist/src/dht/contact/ContactList.js.map +1 -1
- package/dist/src/dht/contact/RandomContactList.d.ts +4 -4
- package/dist/src/dht/contact/RandomContactList.js +13 -12
- package/dist/src/dht/contact/RandomContactList.js.map +1 -1
- package/dist/src/dht/contact/RingContactList.d.ts +31 -0
- package/dist/src/dht/contact/RingContactList.js +133 -0
- package/dist/src/dht/contact/RingContactList.js.map +1 -0
- package/dist/src/dht/contact/{Remote.d.ts → RpcRemote.d.ts} +8 -7
- package/dist/src/dht/contact/{Remote.js → RpcRemote.js} +16 -13
- package/dist/src/dht/contact/RpcRemote.js.map +1 -0
- package/dist/src/dht/contact/SortedContactList.d.ts +29 -15
- package/dist/src/dht/contact/SortedContactList.js +79 -42
- package/dist/src/dht/contact/SortedContactList.js.map +1 -1
- package/dist/src/dht/contact/ringIdentifiers.d.ts +16 -0
- package/dist/src/dht/contact/ringIdentifiers.js +54 -0
- package/dist/src/dht/contact/ringIdentifiers.js.map +1 -0
- package/dist/src/dht/discovery/DiscoverySession.d.ts +8 -18
- package/dist/src/dht/discovery/DiscoverySession.js +32 -48
- package/dist/src/dht/discovery/DiscoverySession.js.map +1 -1
- package/dist/src/dht/discovery/PeerDiscovery.d.ts +16 -12
- package/dist/src/dht/discovery/PeerDiscovery.js +82 -39
- package/dist/src/dht/discovery/PeerDiscovery.js.map +1 -1
- package/dist/src/dht/discovery/RingDiscoverySession.d.ts +29 -0
- package/dist/src/dht/discovery/RingDiscoverySession.js +123 -0
- package/dist/src/dht/discovery/RingDiscoverySession.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.d.ts +36 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js +166 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.d.ts +14 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js +26 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.d.ts +6 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js +44 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.d.ts +44 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js +187 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.d.ts +14 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js +20 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js.map +1 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.d.ts +6 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js +21 -0
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.js.map +1 -0
- package/dist/src/dht/routing/DuplicateDetector.d.ts +2 -4
- package/dist/src/dht/routing/DuplicateDetector.js +10 -15
- package/dist/src/dht/routing/DuplicateDetector.js.map +1 -1
- package/dist/src/dht/routing/Router.d.ts +11 -27
- package/dist/src/dht/routing/Router.js +92 -58
- package/dist/src/dht/routing/Router.js.map +1 -1
- package/dist/src/dht/routing/RouterRpcLocal.d.ts +3 -4
- package/dist/src/dht/routing/RouterRpcLocal.js +17 -16
- package/dist/src/dht/routing/RouterRpcLocal.js.map +1 -1
- package/dist/src/dht/routing/RouterRpcRemote.d.ts +3 -3
- package/dist/src/dht/routing/RouterRpcRemote.js +29 -20
- package/dist/src/dht/routing/RouterRpcRemote.js.map +1 -1
- package/dist/src/dht/routing/RoutingSession.d.ts +29 -21
- package/dist/src/dht/routing/RoutingSession.js +93 -68
- package/dist/src/dht/routing/RoutingSession.js.map +1 -1
- package/dist/src/dht/routing/RoutingTablesCache.d.ts +24 -0
- package/dist/src/dht/routing/RoutingTablesCache.js +46 -0
- package/dist/src/dht/routing/RoutingTablesCache.js.map +1 -0
- package/dist/src/dht/routing/getPreviousPeer.js.map +1 -1
- package/dist/src/dht/store/LocalDataStore.d.ts +9 -14
- package/dist/src/dht/store/LocalDataStore.js +46 -72
- package/dist/src/dht/store/LocalDataStore.js.map +1 -1
- package/dist/src/dht/store/StoreManager.d.ts +33 -0
- package/dist/src/dht/store/StoreManager.js +182 -0
- package/dist/src/dht/store/StoreManager.js.map +1 -0
- package/dist/src/dht/store/StoreRpcLocal.d.ts +11 -41
- package/dist/src/dht/store/StoreRpcLocal.js +27 -234
- package/dist/src/dht/store/StoreRpcLocal.js.map +1 -1
- package/dist/src/dht/store/StoreRpcRemote.d.ts +6 -7
- package/dist/src/dht/store/StoreRpcRemote.js +10 -20
- package/dist/src/dht/store/StoreRpcRemote.js.map +1 -1
- package/dist/src/exports.d.ts +5 -3
- package/dist/src/exports.js +10 -8
- package/dist/src/exports.js.map +1 -1
- package/dist/src/helpers/AddressTools.js +2 -0
- package/dist/src/helpers/AddressTools.js.map +1 -1
- package/dist/src/helpers/Connectivity.js.map +1 -1
- package/dist/src/helpers/MapWithTtl.d.ts +14 -0
- package/dist/src/helpers/MapWithTtl.js +60 -0
- package/dist/src/helpers/MapWithTtl.js.map +1 -0
- package/dist/src/helpers/createPeerDescriptor.d.ts +3 -0
- package/dist/src/helpers/createPeerDescriptor.js +57 -0
- package/dist/src/helpers/createPeerDescriptor.js.map +1 -0
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.d.ts +2 -0
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.js +30 -0
- package/dist/src/helpers/createPeerDescriptorSignaturePayload.js.map +1 -0
- package/dist/src/helpers/debugHelpers.js.map +1 -1
- package/dist/src/helpers/errors.js +2 -0
- package/dist/src/helpers/errors.js.map +1 -1
- package/dist/src/helpers/offering.d.ts +4 -0
- package/dist/src/helpers/offering.js +18 -0
- package/dist/src/helpers/offering.js.map +1 -0
- package/dist/src/helpers/protoClasses.js +2 -3
- package/dist/src/helpers/protoClasses.js.map +1 -1
- package/dist/src/helpers/protoToString.js.map +1 -1
- package/dist/src/helpers/version.d.ts +6 -0
- package/dist/src/helpers/version.js +38 -0
- package/dist/src/helpers/version.js.map +1 -0
- package/dist/src/identifiers.d.ts +10 -0
- package/dist/src/identifiers.js +31 -0
- package/dist/src/identifiers.js.map +1 -0
- package/dist/src/proto/google/protobuf/any.js +8 -8
- package/dist/src/proto/google/protobuf/any.js.map +1 -1
- package/dist/src/proto/google/protobuf/empty.js +2 -4
- package/dist/src/proto/google/protobuf/empty.js.map +1 -1
- package/dist/src/proto/google/protobuf/timestamp.js +10 -10
- package/dist/src/proto/google/protobuf/timestamp.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +46 -49
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +63 -54
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +226 -232
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +146 -168
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +26 -29
- package/dist/src/proto/packages/proto-rpc/protos/ProtoRpc.js +1 -1
- package/dist/src/rpc-protocol/DhtCallContext.d.ts +2 -2
- package/dist/src/rpc-protocol/DhtCallContext.js +8 -0
- package/dist/src/rpc-protocol/DhtCallContext.js.map +1 -1
- package/dist/src/rpc-protocol/DhtRpcOptions.d.ts +2 -1
- package/dist/src/transport/ITransport.d.ts +10 -2
- package/dist/src/transport/ITransport.js +5 -0
- package/dist/src/transport/ITransport.js.map +1 -1
- package/dist/src/transport/ListeningRpcCommunicator.js +3 -1
- package/dist/src/transport/ListeningRpcCommunicator.js.map +1 -1
- package/dist/src/transport/RoutingRpcCommunicator.d.ts +4 -2
- package/dist/src/transport/RoutingRpcCommunicator.js +19 -12
- package/dist/src/transport/RoutingRpcCommunicator.js.map +1 -1
- package/jest.config.js +4 -1
- package/karma-setup.js +2 -0
- package/karma.config.js +13 -9
- package/package.json +16 -13
- package/protos/DhtRpc.proto +76 -76
- package/src/connection/Connection.ts +6 -1
- package/src/connection/ConnectionLockHandler.ts +30 -22
- package/src/connection/ConnectionLockRpcLocal.ts +7 -12
- package/src/connection/ConnectionLockRpcRemote.ts +9 -19
- package/src/connection/ConnectionManager.ts +132 -138
- package/src/connection/ConnectorFacade.ts +10 -9
- package/src/connection/Handshaker.ts +23 -11
- package/src/connection/IConnection.ts +2 -8
- package/src/connection/ManagedConnection.ts +34 -35
- package/src/connection/connectivityChecker.ts +109 -0
- package/src/connection/connectivityRequestHandler.ts +103 -0
- package/src/connection/simulator/Simulator.ts +6 -37
- package/src/connection/simulator/SimulatorConnection.ts +23 -25
- package/src/connection/simulator/SimulatorConnector.ts +11 -11
- package/src/connection/webrtc/BrowserWebrtcConnection.ts +17 -25
- package/src/connection/webrtc/NodeWebrtcConnection.ts +24 -26
- package/src/connection/webrtc/WebrtcConnector.ts +18 -29
- package/src/connection/webrtc/WebrtcConnectorRpcLocal.ts +29 -24
- package/src/connection/webrtc/WebrtcConnectorRpcRemote.ts +4 -14
- package/src/connection/webrtc/iceServerAsString.ts +1 -1
- package/src/connection/websocket/AutoCertifierClientFacade.ts +4 -6
- package/src/connection/websocket/ClientWebsocket.ts +10 -4
- package/src/connection/websocket/WebsocketConnector.ts +120 -97
- package/src/connection/websocket/WebsocketConnectorRpcLocal.ts +13 -15
- package/src/connection/websocket/WebsocketConnectorRpcRemote.ts +7 -27
- package/src/connection/websocket/WebsocketServer.ts +50 -53
- package/src/connection/websocket/WebsocketServerConnection.ts +104 -0
- package/src/dht/DhtNode.ts +289 -410
- package/src/dht/DhtNodeRpcLocal.ts +25 -17
- package/src/dht/DhtNodeRpcRemote.ts +43 -27
- package/src/dht/ExternalApiRpcLocal.ts +30 -17
- package/src/dht/ExternalApiRpcRemote.ts +14 -11
- package/src/dht/PeerManager.ts +339 -0
- package/src/dht/contact/Contact.ts +4 -4
- package/src/dht/contact/ContactList.ts +11 -10
- package/src/dht/contact/RandomContactList.ts +15 -15
- package/src/dht/contact/RingContactList.ts +151 -0
- package/src/dht/contact/{Remote.ts → RpcRemote.ts} +16 -19
- package/src/dht/contact/SortedContactList.ts +120 -72
- package/src/dht/contact/ringIdentifiers.ts +62 -0
- package/src/dht/discovery/DiscoverySession.ts +36 -61
- package/src/dht/discovery/PeerDiscovery.ts +98 -43
- package/src/dht/discovery/RingDiscoverySession.ts +160 -0
- package/src/dht/recursive-operation/RecursiveOperationManager.ts +246 -0
- package/src/dht/recursive-operation/RecursiveOperationRpcLocal.ts +34 -0
- package/src/dht/recursive-operation/RecursiveOperationRpcRemote.ts +43 -0
- package/src/dht/recursive-operation/RecursiveOperationSession.ts +232 -0
- package/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.ts +35 -0
- package/src/dht/recursive-operation/RecursiveOperationSessionRpcRemote.ts +30 -0
- package/src/dht/routing/DuplicateDetector.ts +9 -21
- package/src/dht/routing/Router.ts +95 -92
- package/src/dht/routing/RouterRpcLocal.ts +16 -18
- package/src/dht/routing/RouterRpcRemote.ts +26 -24
- package/src/dht/routing/RoutingSession.ts +119 -98
- package/src/dht/routing/RoutingTablesCache.ts +58 -0
- package/src/dht/routing/getPreviousPeer.ts +1 -1
- package/src/dht/store/LocalDataStore.ts +47 -77
- package/src/dht/store/StoreManager.ts +209 -0
- package/src/dht/store/StoreRpcLocal.ts +39 -308
- package/src/dht/store/StoreRpcRemote.ts +13 -31
- package/src/exports.ts +13 -3
- package/src/helpers/AddressTools.ts +2 -0
- package/src/helpers/MapWithTtl.ts +71 -0
- package/src/helpers/createPeerDescriptor.ts +57 -0
- package/src/helpers/createPeerDescriptorSignaturePayload.ts +28 -0
- package/src/helpers/offering.ts +15 -0
- package/src/helpers/protoClasses.ts +4 -6
- package/src/helpers/version.ts +32 -0
- package/src/identifiers.ts +29 -0
- package/src/proto/google/protobuf/any.ts +4 -4
- package/src/proto/google/protobuf/empty.ts +2 -4
- package/src/proto/google/protobuf/timestamp.ts +4 -4
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +65 -68
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +27 -30
- package/src/proto/packages/dht/protos/DhtRpc.ts +297 -313
- package/src/proto/packages/proto-rpc/protos/ProtoRpc.ts +1 -1
- package/src/rpc-protocol/DhtCallContext.ts +2 -2
- package/src/rpc-protocol/DhtRpcOptions.ts +2 -1
- package/src/transport/ITransport.ts +11 -2
- package/src/transport/ListeningRpcCommunicator.ts +1 -1
- package/src/transport/RoutingRpcCommunicator.ts +21 -14
- package/test/RandomGraphSimulation.ts +3 -2
- package/test/benchmark/Find.test.ts +13 -28
- package/test/benchmark/KademliaCorrectness.test.ts +24 -28
- package/test/benchmark/RingCorrectness.test.ts +157 -0
- package/test/benchmark/SortedContactListBenchmark.test.ts +151 -0
- package/test/benchmark/WebsocketServerMemoryLeak.test.ts +41 -0
- package/test/benchmark/hybrid-network-simulation/RingContactList.test.ts +72 -0
- package/test/benchmark/kademlia-simulation/Contact.ts +9 -9
- package/test/benchmark/kademlia-simulation/KademliaSimulation.ts +11 -11
- package/test/benchmark/kademlia-simulation/SimulationNode.ts +29 -25
- package/test/data/generateGroundTruthData.ts +7 -6
- package/test/end-to-end/Layer0-Layer1.test.ts +11 -15
- package/test/end-to-end/Layer0.test.ts +19 -22
- package/test/end-to-end/Layer0MixedConnectionTypes.test.ts +19 -21
- package/test/end-to-end/Layer0Webrtc-Layer1.test.ts +26 -28
- package/test/end-to-end/Layer0Webrtc.test.ts +19 -19
- package/test/end-to-end/Layer1-Scale-WebSocket.test.ts +10 -18
- package/test/end-to-end/Layer1-Scale-Webrtc.test.ts +8 -15
- package/test/end-to-end/RecoveryFromFailedAutoCertification.test.ts +2 -2
- package/test/end-to-end/WebsocketConnectionRequest.test.ts +8 -9
- package/test/end-to-end/memory-leak.test.ts +19 -24
- package/test/integration/ConnectionLocking.test.ts +66 -60
- package/test/integration/ConnectionManager.test.ts +43 -63
- package/test/integration/ConnectivityChecking.test.ts +52 -0
- package/test/integration/DhtJoinPeerDiscovery.test.ts +8 -12
- package/test/integration/DhtNodeExternalAPI.test.ts +17 -21
- package/test/integration/DhtNodeRpcRemote.test.ts +19 -26
- package/test/integration/DhtRpc.test.ts +20 -24
- package/test/integration/Find.test.ts +10 -12
- package/test/integration/Layer1-scale.test.ts +25 -37
- package/test/integration/Mock-Layer1-Layer0.test.ts +39 -59
- package/test/integration/MultipleEntryPointJoining.test.ts +14 -14
- package/test/integration/ReplicateData.test.ts +106 -0
- package/test/integration/RouteMessage.test.ts +42 -68
- package/test/integration/RouterRpcRemote.test.ts +19 -24
- package/test/integration/ScaleDownDht.test.ts +14 -12
- package/test/integration/SimultaneousConnections.test.ts +112 -111
- package/test/integration/Store.test.ts +43 -27
- package/test/integration/StoreAndDelete.test.ts +36 -48
- package/test/integration/StoreOnDhtWithThreeNodes.test.ts +59 -0
- package/test/integration/StoreOnDhtWithTwoNodes.test.ts +17 -37
- package/test/integration/StoreRpcRemote.test.ts +20 -32
- package/test/integration/WebrtcConnectionManagement.test.ts +39 -25
- package/test/integration/WebrtcConnectorRpc.test.ts +6 -11
- package/test/integration/WebsocketConnectionManagement.test.ts +87 -22
- package/test/integration/WebsocketConnectorRpc.test.ts +14 -24
- package/test/integration/{RpcErrors.test.ts → rpc-connections-over-webrpc.test.ts} +15 -26
- package/test/unit/AddressTools.test.ts +4 -0
- package/test/unit/ConnectivityHelpers.test.ts +9 -17
- package/test/unit/DuplicateDetector.test.ts +8 -5
- package/test/unit/LocalDataStore.test.ts +78 -75
- package/test/unit/PeerManager.test.ts +33 -0
- package/test/unit/RandomContactList.test.ts +12 -9
- package/test/unit/RecursiveOperationManager.test.ts +157 -0
- package/test/unit/RecursiveOperationSession.test.ts +68 -0
- package/test/unit/Router.test.ts +52 -35
- package/test/unit/RoutingSession.test.ts +79 -0
- package/test/unit/SortedContactList.test.ts +61 -30
- package/test/unit/StoreManager.test.ts +138 -0
- package/test/unit/WebsocketConnector.test.ts +27 -35
- package/test/unit/connectivityRequestHandler.test.ts +104 -0
- package/test/unit/createPeerDescriptor.test.ts +69 -0
- package/test/unit/customMatchers.test.ts +16 -0
- package/test/unit/version.test.ts +18 -0
- package/test/utils/FakeTransport.ts +47 -0
- package/test/utils/customMatchers.ts +71 -0
- package/test/utils/mock/MockRpcCommunicator.ts +7 -0
- package/test/utils/mock/Router.ts +13 -3
- package/test/utils/mock/Transport.ts +1 -1
- package/test/utils/mock/mockDataEntry.ts +38 -0
- package/test/utils/utils.ts +104 -107
- package/tsconfig.browser.json +2 -1
- package/tsconfig.jest.json +4 -2
- package/tsconfig.node.json +4 -2
- package/dist/src/connection/ConnectivityChecker.d.ts +0 -17
- package/dist/src/connection/ConnectivityChecker.js +0 -208
- package/dist/src/connection/ConnectivityChecker.js.map +0 -1
- package/dist/src/connection/websocket/ServerWebsocket.js +0 -100
- package/dist/src/connection/websocket/ServerWebsocket.js.map +0 -1
- package/dist/src/dht/contact/Remote.js.map +0 -1
- package/dist/src/dht/find/FindRpcLocal.d.ts +0 -14
- package/dist/src/dht/find/FindRpcLocal.js +0 -25
- package/dist/src/dht/find/FindRpcLocal.js.map +0 -1
- package/dist/src/dht/find/FindSession.d.ts +0 -44
- package/dist/src/dht/find/FindSession.js +0 -145
- package/dist/src/dht/find/FindSession.js.map +0 -1
- package/dist/src/dht/find/FindSessionRpcLocal.d.ts +0 -12
- package/dist/src/dht/find/FindSessionRpcLocal.js +0 -17
- package/dist/src/dht/find/FindSessionRpcLocal.js.map +0 -1
- package/dist/src/dht/find/FindSessionRpcRemote.d.ts +0 -6
- package/dist/src/dht/find/FindSessionRpcRemote.js +0 -21
- package/dist/src/dht/find/FindSessionRpcRemote.js.map +0 -1
- package/dist/src/dht/find/Finder.d.ts +0 -49
- package/dist/src/dht/find/Finder.js +0 -184
- package/dist/src/dht/find/Finder.js.map +0 -1
- package/dist/src/dht/routing/FindRpcRemote.d.ts +0 -6
- package/dist/src/dht/routing/FindRpcRemote.js +0 -41
- package/dist/src/dht/routing/FindRpcRemote.js.map +0 -1
- package/dist/src/helpers/PeerID.d.ts +0 -24
- package/dist/src/helpers/PeerID.js +0 -78
- package/dist/src/helpers/PeerID.js.map +0 -1
- package/dist/src/helpers/UUID.d.ts +0 -8
- package/dist/src/helpers/UUID.js +0 -36
- package/dist/src/helpers/UUID.js.map +0 -1
- package/dist/src/helpers/kademliaId.d.ts +0 -1
- package/dist/src/helpers/kademliaId.js +0 -14
- package/dist/src/helpers/kademliaId.js.map +0 -1
- package/dist/src/helpers/peerIdFromPeerDescriptor.d.ts +0 -6
- package/dist/src/helpers/peerIdFromPeerDescriptor.js +0 -23
- package/dist/src/helpers/peerIdFromPeerDescriptor.js.map +0 -1
- package/src/connection/ConnectivityChecker.ts +0 -199
- package/src/connection/websocket/ServerWebsocket.ts +0 -114
- package/src/dht/find/FindRpcLocal.ts +0 -35
- package/src/dht/find/FindSession.ts +0 -178
- package/src/dht/find/FindSessionRpcLocal.ts +0 -25
- package/src/dht/find/FindSessionRpcRemote.ts +0 -30
- package/src/dht/find/Finder.ts +0 -275
- package/src/dht/routing/FindRpcRemote.ts +0 -40
- package/src/helpers/PeerID.ts +0 -88
- package/src/helpers/UUID.ts +0 -35
- package/src/helpers/kademliaId.ts +0 -8
- package/src/helpers/peerIdFromPeerDescriptor.ts +0 -20
- package/test/integration/MigrateData.test.ts +0 -204
- package/test/unit/Finder.test.ts +0 -110
- package/test/unit/PeerID.test.ts +0 -22
- package/test/unit/UUID.test.ts +0 -55
|
@@ -1,31 +1,19 @@
|
|
|
1
|
-
import { toProtoRpcClient } from '@streamr/proto-rpc'
|
|
2
1
|
import { CountMetric, LevelMetric, Logger, Metric, MetricsContext, MetricsDefinition, RateMetric, waitForEvent3 } from '@streamr/utils'
|
|
3
2
|
import { EventEmitter } from 'eventemitter3'
|
|
4
|
-
import { Contact } from '../dht/contact/Contact'
|
|
5
3
|
import { SortedContactList } from '../dht/contact/SortedContactList'
|
|
6
4
|
import { DuplicateDetector } from '../dht/routing/DuplicateDetector'
|
|
7
|
-
import { PeerIDKey } from '../helpers/PeerID'
|
|
8
5
|
import * as Err from '../helpers/errors'
|
|
9
|
-
import {
|
|
10
|
-
areEqualPeerDescriptors,
|
|
11
|
-
getNodeIdFromPeerDescriptor,
|
|
12
|
-
keyFromPeerDescriptor,
|
|
13
|
-
peerIdFromPeerDescriptor
|
|
14
|
-
} from '../helpers/peerIdFromPeerDescriptor'
|
|
15
|
-
import { protoToString } from '../helpers/protoToString'
|
|
16
6
|
import {
|
|
17
7
|
DisconnectMode,
|
|
18
8
|
DisconnectNotice,
|
|
19
|
-
DisconnectNoticeResponse,
|
|
20
9
|
LockRequest,
|
|
21
10
|
LockResponse,
|
|
22
11
|
Message,
|
|
23
|
-
MessageType,
|
|
24
12
|
PeerDescriptor,
|
|
25
13
|
UnlockRequest
|
|
26
14
|
} from '../proto/packages/dht/protos/DhtRpc'
|
|
27
15
|
import { ConnectionLockRpcClient } from '../proto/packages/dht/protos/DhtRpc.client'
|
|
28
|
-
import { ITransport, TransportEvents } from '../transport/ITransport'
|
|
16
|
+
import { DEFAULT_SEND_OPTIONS, ITransport, SendOptions, TransportEvents } from '../transport/ITransport'
|
|
29
17
|
import { RoutingRpcCommunicator } from '../transport/RoutingRpcCommunicator'
|
|
30
18
|
import { ConnectionLockHandler, LockID } from './ConnectionLockHandler'
|
|
31
19
|
import { ConnectorFacade } from './ConnectorFacade'
|
|
@@ -34,6 +22,8 @@ import { ConnectionLockRpcRemote } from './ConnectionLockRpcRemote'
|
|
|
34
22
|
import { WEBRTC_CLEANUP } from './webrtc/NodeWebrtcConnection'
|
|
35
23
|
import { ServerCallContext } from '@protobuf-ts/runtime-rpc'
|
|
36
24
|
import { ConnectionLockRpcLocal } from './ConnectionLockRpcLocal'
|
|
25
|
+
import { DhtAddress, areEqualPeerDescriptors, getNodeIdFromPeerDescriptor } from '../identifiers'
|
|
26
|
+
import { getOfferer } from '../helpers/offering'
|
|
37
27
|
|
|
38
28
|
export interface ConnectionManagerConfig {
|
|
39
29
|
maxConnections?: number
|
|
@@ -55,9 +45,6 @@ interface ConnectionManagerMetrics extends MetricsDefinition {
|
|
|
55
45
|
connectionTotalFailureCount: Metric
|
|
56
46
|
}
|
|
57
47
|
|
|
58
|
-
// TODO move this type identifiers.ts and use also in other classes (and rename to ServiceID)
|
|
59
|
-
type ServiceId = string
|
|
60
|
-
|
|
61
48
|
const logger = new Logger(module)
|
|
62
49
|
|
|
63
50
|
enum ConnectionManagerState {
|
|
@@ -68,10 +55,10 @@ enum ConnectionManagerState {
|
|
|
68
55
|
}
|
|
69
56
|
|
|
70
57
|
export interface ConnectionLocker {
|
|
71
|
-
lockConnection(targetDescriptor: PeerDescriptor,
|
|
72
|
-
unlockConnection(targetDescriptor: PeerDescriptor,
|
|
73
|
-
weakLockConnection(
|
|
74
|
-
weakUnlockConnection(
|
|
58
|
+
lockConnection(targetDescriptor: PeerDescriptor, lockId: LockID): void
|
|
59
|
+
unlockConnection(targetDescriptor: PeerDescriptor, lockId: LockID): void
|
|
60
|
+
weakLockConnection(nodeId: DhtAddress, lockId: LockID): void
|
|
61
|
+
weakUnlockConnection(nodeId: DhtAddress, lockId: LockID): void
|
|
75
62
|
}
|
|
76
63
|
|
|
77
64
|
export interface PortRange {
|
|
@@ -95,7 +82,7 @@ const INTERNAL_SERVICE_ID = 'system/connection-manager'
|
|
|
95
82
|
// - if we create stricter types for incoming messages (message.sourceDescriptor or
|
|
96
83
|
// disconnectNotice.peerDescriptor)
|
|
97
84
|
// - if ManagedConnection#peerDescriptor is never undefined
|
|
98
|
-
export const getNodeIdOrUnknownFromPeerDescriptor = (peerDescriptor: PeerDescriptor | undefined): string => {
|
|
85
|
+
export const getNodeIdOrUnknownFromPeerDescriptor = (peerDescriptor: PeerDescriptor | undefined): string => {
|
|
99
86
|
if (peerDescriptor !== undefined) {
|
|
100
87
|
return getNodeIdFromPeerDescriptor(peerDescriptor)
|
|
101
88
|
} else {
|
|
@@ -107,10 +94,11 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
107
94
|
|
|
108
95
|
private config: ConnectionManagerConfig
|
|
109
96
|
private readonly metricsContext: MetricsContext
|
|
110
|
-
|
|
97
|
+
// TODO use config option or named constant?
|
|
98
|
+
private readonly duplicateMessageDetector: DuplicateDetector = new DuplicateDetector(10000)
|
|
111
99
|
private readonly metrics: ConnectionManagerMetrics
|
|
112
100
|
private locks = new ConnectionLockHandler()
|
|
113
|
-
private connections: Map<
|
|
101
|
+
private connections: Map<DhtAddress, ManagedConnection> = new Map()
|
|
114
102
|
private readonly connectorFacade: ConnectorFacade
|
|
115
103
|
private rpcCommunicator?: RoutingRpcCommunicator
|
|
116
104
|
private disconnectorIntervalRef?: NodeJS.Timeout
|
|
@@ -135,12 +123,13 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
135
123
|
this.connectorFacade = this.config.createConnectorFacade()
|
|
136
124
|
this.send = this.send.bind(this)
|
|
137
125
|
this.rpcCommunicator = new RoutingRpcCommunicator(INTERNAL_SERVICE_ID, this.send, {
|
|
138
|
-
rpcRequestTimeout: 10000
|
|
126
|
+
rpcRequestTimeout: 10000 // TODO use config option or named constant?
|
|
139
127
|
})
|
|
140
128
|
const lockRpcLocal = new ConnectionLockRpcLocal({
|
|
141
|
-
addRemoteLocked: (id:
|
|
142
|
-
removeRemoteLocked: (id:
|
|
129
|
+
addRemoteLocked: (id: DhtAddress, lockId: LockID) => this.locks.addRemoteLocked(id, lockId),
|
|
130
|
+
removeRemoteLocked: (id: DhtAddress, lockId: LockID) => this.locks.removeRemoteLocked(id, lockId),
|
|
143
131
|
closeConnection: (peerDescriptor: PeerDescriptor, gracefulLeave: boolean, reason?: string) => {
|
|
132
|
+
// TODO should we have some handling for this floating promise?
|
|
144
133
|
this.closeConnection(peerDescriptor, gracefulLeave, reason)
|
|
145
134
|
},
|
|
146
135
|
getLocalPeerDescriptor: () => this.getLocalPeerDescriptor()
|
|
@@ -149,7 +138,7 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
149
138
|
(req: LockRequest, context: ServerCallContext) => lockRpcLocal.lockRequest(req, context))
|
|
150
139
|
this.rpcCommunicator.registerRpcNotification(UnlockRequest, 'unlockRequest',
|
|
151
140
|
(req: UnlockRequest, context: ServerCallContext) => lockRpcLocal.unlockRequest(req, context))
|
|
152
|
-
this.rpcCommunicator.
|
|
141
|
+
this.rpcCommunicator.registerRpcNotification(DisconnectNotice, 'gracefulDisconnect',
|
|
153
142
|
(req: DisconnectNotice, context: ServerCallContext) => lockRpcLocal.gracefulDisconnect(req, context))
|
|
154
143
|
}
|
|
155
144
|
|
|
@@ -157,19 +146,31 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
157
146
|
if (this.connections.size <= maxConnections) {
|
|
158
147
|
return
|
|
159
148
|
}
|
|
160
|
-
const disconnectionCandidates = new SortedContactList<
|
|
161
|
-
|
|
162
|
-
|
|
149
|
+
const disconnectionCandidates = new SortedContactList<ManagedConnection>({
|
|
150
|
+
referenceId: getNodeIdFromPeerDescriptor(this.getLocalPeerDescriptor()),
|
|
151
|
+
maxSize: 100000, // TODO use config option or named constant?
|
|
152
|
+
allowToContainReferenceId: false,
|
|
153
|
+
emitEvents: false
|
|
154
|
+
})
|
|
155
|
+
this.connections.forEach((connection, key) => {
|
|
156
|
+
// TODO: Investigate why multiple invalid WS client connections to the same
|
|
157
|
+
// server with a different nodeId can remain in the this.connections map.
|
|
158
|
+
// Seems to only happen if the ConnectionManager acting as client is not running a WS server itself.
|
|
159
|
+
if (connection.getPeerDescriptor() !== undefined && !this.hasConnection(getNodeIdFromPeerDescriptor(connection.getPeerDescriptor()!))) {
|
|
160
|
+
logger.trace(`Attempting to disconnect a hanging connection to ${getNodeIdFromPeerDescriptor(connection.getPeerDescriptor()!)}`)
|
|
161
|
+
connection.close(false).catch(() => {})
|
|
162
|
+
this.connections.delete(key)
|
|
163
|
+
} else if (!this.locks.isLocked(connection.getNodeId()) && Date.now() - connection.getLastUsed() > lastUsedLimit) {
|
|
163
164
|
logger.trace('disconnecting in timeout interval: ' + getNodeIdOrUnknownFromPeerDescriptor(connection.getPeerDescriptor()))
|
|
164
|
-
disconnectionCandidates.addContact(
|
|
165
|
+
disconnectionCandidates.addContact(connection)
|
|
165
166
|
}
|
|
166
167
|
})
|
|
167
168
|
const sortedCandidates = disconnectionCandidates.getAllContacts()
|
|
168
169
|
const targetNum = this.connections.size - maxConnections
|
|
169
170
|
for (let i = 0; i < sortedCandidates.length && i < targetNum; i++) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
const peerDescriptor = sortedCandidates[sortedCandidates.length - 1 - i].getPeerDescriptor()!
|
|
172
|
+
logger.trace('garbageCollecting ' + getNodeIdFromPeerDescriptor(peerDescriptor))
|
|
173
|
+
this.gracefullyDisconnectAsync(peerDescriptor, DisconnectMode.NORMAL).catch((_e) => { })
|
|
173
174
|
}
|
|
174
175
|
}
|
|
175
176
|
|
|
@@ -181,7 +182,7 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
181
182
|
logger.trace(`Starting ConnectionManager...`)
|
|
182
183
|
await this.connectorFacade.start(
|
|
183
184
|
(connection: ManagedConnection) => this.onNewConnection(connection),
|
|
184
|
-
(
|
|
185
|
+
(nodeId: DhtAddress) => this.hasConnection(nodeId),
|
|
185
186
|
this
|
|
186
187
|
)
|
|
187
188
|
// Garbage collection of connections
|
|
@@ -189,7 +190,7 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
189
190
|
logger.trace('disconnectorInterval')
|
|
190
191
|
const LAST_USED_LIMIT = 20000
|
|
191
192
|
this.garbageCollectConnections(this.config.maxConnections ?? 80, LAST_USED_LIMIT)
|
|
192
|
-
}, 5000)
|
|
193
|
+
}, 5000) // TODO use config option or named constant?
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
public async stop(): Promise<void> {
|
|
@@ -212,7 +213,9 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
212
213
|
}
|
|
213
214
|
} else {
|
|
214
215
|
logger.trace('handshake of connection not completed, force-closing')
|
|
216
|
+
// TODO use config option or named constant?
|
|
215
217
|
const eventReceived = waitForEvent3<ManagedConnectionEvents>(peer, 'disconnected', 2000)
|
|
218
|
+
// TODO should we have some handling for this floating promise?
|
|
216
219
|
peer.close(true)
|
|
217
220
|
try {
|
|
218
221
|
await eventReceived
|
|
@@ -234,96 +237,88 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
234
237
|
WEBRTC_CLEANUP.cleanUp()
|
|
235
238
|
}
|
|
236
239
|
|
|
237
|
-
public
|
|
238
|
-
return this.locks.
|
|
240
|
+
public getLocalLockedConnectionCount(): number {
|
|
241
|
+
return this.locks.getLocalLockedConnectionCount()
|
|
239
242
|
}
|
|
240
243
|
|
|
241
|
-
public
|
|
242
|
-
return this.locks.
|
|
244
|
+
public getRemoteLockedConnectionCount(): number {
|
|
245
|
+
return this.locks.getRemoteLockedConnectionCount()
|
|
243
246
|
}
|
|
244
247
|
|
|
245
|
-
public
|
|
246
|
-
return this.locks.
|
|
248
|
+
public getWeakLockedConnectionCount(): number {
|
|
249
|
+
return this.locks.getWeakLockedConnectionCount()
|
|
247
250
|
}
|
|
248
251
|
|
|
249
|
-
public async send(message: Message,
|
|
250
|
-
if (this.state === ConnectionManagerState.STOPPED && !
|
|
252
|
+
public async send(message: Message, opts: SendOptions = DEFAULT_SEND_OPTIONS): Promise<void> {
|
|
253
|
+
if ((this.state === ConnectionManagerState.STOPPED || this.state === ConnectionManagerState.STOPPING) && !opts.sendIfStopped) {
|
|
251
254
|
return
|
|
252
255
|
}
|
|
253
256
|
const peerDescriptor = message.targetDescriptor!
|
|
254
257
|
if (this.isConnectionToSelf(peerDescriptor)) {
|
|
255
258
|
throw new Err.CannotConnectToSelf('Cannot send to self')
|
|
256
259
|
}
|
|
257
|
-
|
|
260
|
+
const nodeId = getNodeIdFromPeerDescriptor(peerDescriptor)
|
|
261
|
+
logger.trace(`Sending message to: ${nodeId}`)
|
|
258
262
|
message = {
|
|
259
263
|
...message,
|
|
260
264
|
sourceDescriptor: this.getLocalPeerDescriptor()
|
|
261
265
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
if (!connection && !doNotConnect) {
|
|
266
|
+
let connection = this.connections.get(nodeId)
|
|
267
|
+
if (!connection && opts.connect) {
|
|
265
268
|
connection = this.connectorFacade.createConnection(peerDescriptor)
|
|
266
269
|
this.onNewConnection(connection)
|
|
267
270
|
} else if (!connection) {
|
|
268
|
-
throw new Err.SendFailed('No connection to target,
|
|
271
|
+
throw new Err.SendFailed('No connection to target, connect flag is false')
|
|
269
272
|
}
|
|
270
273
|
const binary = Message.toBinary(message)
|
|
271
274
|
this.metrics.sendBytesPerSecond.record(binary.byteLength)
|
|
272
275
|
this.metrics.sendMessagesPerSecond.record(1)
|
|
273
|
-
return connection.send(binary,
|
|
276
|
+
return connection.send(binary, opts.connect)
|
|
274
277
|
}
|
|
275
278
|
|
|
276
|
-
private isConnectionToSelf(peerDescriptor: PeerDescriptor): boolean {
|
|
279
|
+
private isConnectionToSelf(peerDescriptor: PeerDescriptor): boolean {
|
|
277
280
|
return areEqualPeerDescriptors(peerDescriptor, this.getLocalPeerDescriptor()) || this.isOwnWebsocketServer(peerDescriptor)
|
|
278
281
|
}
|
|
279
282
|
|
|
280
283
|
private isOwnWebsocketServer(peerDescriptor: PeerDescriptor): boolean {
|
|
281
284
|
const localPeerDescriptor = this.getLocalPeerDescriptor()
|
|
282
285
|
if ((peerDescriptor.websocket !== undefined) && (localPeerDescriptor.websocket !== undefined)) {
|
|
283
|
-
return ((peerDescriptor.websocket.port === localPeerDescriptor.websocket.port)
|
|
286
|
+
return ((peerDescriptor.websocket.port === localPeerDescriptor.websocket.port)
|
|
284
287
|
&& (peerDescriptor.websocket.host === localPeerDescriptor.websocket.host))
|
|
285
288
|
} else {
|
|
286
289
|
return false
|
|
287
290
|
}
|
|
288
291
|
}
|
|
289
292
|
|
|
290
|
-
public getConnection(
|
|
291
|
-
|
|
292
|
-
return this.connections.get(peerIdKey)
|
|
293
|
+
public getConnection(nodeId: DhtAddress): ManagedConnection | undefined {
|
|
294
|
+
return this.connections.get(nodeId)
|
|
293
295
|
}
|
|
294
296
|
|
|
295
297
|
public getLocalPeerDescriptor(): PeerDescriptor {
|
|
296
298
|
return this.connectorFacade.getLocalPeerDescriptor()!
|
|
297
299
|
}
|
|
298
300
|
|
|
299
|
-
public hasConnection(
|
|
300
|
-
|
|
301
|
-
return this.connections.has(peerIdKey)
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
public hasLocalLockedConnection(peerDescriptor: PeerDescriptor): boolean {
|
|
305
|
-
const peerIdKey = keyFromPeerDescriptor(peerDescriptor)
|
|
306
|
-
return this.locks.isLocalLocked(peerIdKey)
|
|
301
|
+
public hasConnection(nodeId: DhtAddress): boolean {
|
|
302
|
+
return this.connections.has(nodeId)
|
|
307
303
|
}
|
|
308
304
|
|
|
309
|
-
public
|
|
310
|
-
|
|
311
|
-
return this.locks.isRemoteLocked(peerIdKey)
|
|
305
|
+
public hasLocalLockedConnection(nodeId: DhtAddress): boolean {
|
|
306
|
+
return this.locks.isLocalLocked(nodeId)
|
|
312
307
|
}
|
|
313
308
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
return !this.hasConnection(peerDescriptor) // TODO: Add port range check
|
|
309
|
+
public hasRemoteLockedConnection(nodeId: DhtAddress): boolean {
|
|
310
|
+
return this.locks.isRemoteLocked(nodeId)
|
|
317
311
|
}
|
|
318
312
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
313
|
+
private handleMessage(message: Message): void {
|
|
314
|
+
const messageType = message.body.oneofKind
|
|
315
|
+
logger.trace('Received message of type ' + messageType)
|
|
316
|
+
if (messageType !== 'rpcMessage') {
|
|
317
|
+
logger.trace('Filtered out non-RPC message of type ' + messageType)
|
|
323
318
|
return
|
|
324
319
|
}
|
|
325
320
|
if (this.duplicateMessageDetector.isMostLikelyDuplicate(message.messageId)) {
|
|
326
|
-
logger.trace('handleMessage filtered duplicate ' + getNodeIdFromPeerDescriptor(message.sourceDescriptor!)
|
|
321
|
+
logger.trace('handleMessage filtered duplicate ' + getNodeIdFromPeerDescriptor(message.sourceDescriptor!)
|
|
327
322
|
+ ' ' + message.serviceId + ' ' + message.messageId)
|
|
328
323
|
return
|
|
329
324
|
}
|
|
@@ -331,12 +326,20 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
331
326
|
if (message.serviceId === INTERNAL_SERVICE_ID) {
|
|
332
327
|
this.rpcCommunicator?.handleMessageFromPeer(message)
|
|
333
328
|
} else {
|
|
334
|
-
logger.trace('emit "message" ' + getNodeIdFromPeerDescriptor(message.sourceDescriptor!)
|
|
329
|
+
logger.trace('emit "message" ' + getNodeIdFromPeerDescriptor(message.sourceDescriptor!)
|
|
335
330
|
+ ' ' + message.serviceId + ' ' + message.messageId)
|
|
336
331
|
this.emit('message', message)
|
|
337
332
|
}
|
|
338
333
|
}
|
|
339
334
|
|
|
335
|
+
public handleIncomingMessage(message: Message): boolean {
|
|
336
|
+
if (message.serviceId === INTERNAL_SERVICE_ID) {
|
|
337
|
+
this.rpcCommunicator?.handleMessageFromPeer(message)
|
|
338
|
+
return true
|
|
339
|
+
}
|
|
340
|
+
return false
|
|
341
|
+
}
|
|
342
|
+
|
|
340
343
|
private onData(data: Uint8Array, peerDescriptor: PeerDescriptor): void {
|
|
341
344
|
if (this.state === ConnectionManagerState.STOPPED) {
|
|
342
345
|
return
|
|
@@ -346,7 +349,6 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
346
349
|
let message: Message | undefined
|
|
347
350
|
try {
|
|
348
351
|
message = Message.fromBinary(data)
|
|
349
|
-
logger.trace(`received protojson: ${protoToString(message, Message)}`)
|
|
350
352
|
} catch (e) {
|
|
351
353
|
logger.debug(`Parsing incoming data into Message failed: ${e}`)
|
|
352
354
|
return
|
|
@@ -367,26 +369,21 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
367
369
|
}
|
|
368
370
|
|
|
369
371
|
private onDisconnected(connection: ManagedConnection, gracefulLeave: boolean) {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
this.
|
|
376
|
-
|
|
377
|
-
logger.trace(getNodeIdOrUnknownFromPeerDescriptor(connection.getPeerDescriptor())
|
|
378
|
-
+ ' deleted connection in onDisconnected() gracefulLeave: ' + gracefulLeave)
|
|
372
|
+
const nodeId = getNodeIdFromPeerDescriptor(connection.getPeerDescriptor()!)
|
|
373
|
+
logger.trace(nodeId + ' onDisconnected() gracefulLeave: ' + gracefulLeave)
|
|
374
|
+
const storedConnection = this.connections.get(nodeId)
|
|
375
|
+
if (storedConnection && (storedConnection.connectionId === connection.connectionId)) {
|
|
376
|
+
this.locks.clearAllLocks(nodeId)
|
|
377
|
+
this.connections.delete(nodeId)
|
|
378
|
+
logger.trace(nodeId + ' deleted connection in onDisconnected() gracefulLeave: ' + gracefulLeave)
|
|
379
379
|
this.emit('disconnected', connection.getPeerDescriptor()!, gracefulLeave)
|
|
380
380
|
this.onConnectionCountChange()
|
|
381
381
|
} else {
|
|
382
|
-
logger.trace(
|
|
383
|
-
+ ' onDisconnected() did nothing, no such connection in connectionManager')
|
|
382
|
+
logger.trace(nodeId + ' onDisconnected() did nothing, no such connection in connectionManager')
|
|
384
383
|
if (storedConnection) {
|
|
385
|
-
logger.trace(
|
|
386
|
-
+ ' connectionIds do not match ' + storedConnection.connectionId + ' ' + connection.connectionId)
|
|
384
|
+
logger.trace(nodeId + ' connectionIds do not match ' + storedConnection.connectionId + ' ' + connection.connectionId.toString())
|
|
387
385
|
}
|
|
388
386
|
}
|
|
389
|
-
|
|
390
387
|
}
|
|
391
388
|
|
|
392
389
|
private onNewConnection(connection: ManagedConnection): boolean {
|
|
@@ -394,7 +391,6 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
394
391
|
return false
|
|
395
392
|
}
|
|
396
393
|
logger.trace('onNewConnection()')
|
|
397
|
-
connection.offeredAsIncoming = true
|
|
398
394
|
if (!this.acceptNewConnection(connection)) {
|
|
399
395
|
return false
|
|
400
396
|
}
|
|
@@ -413,22 +409,20 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
413
409
|
}
|
|
414
410
|
|
|
415
411
|
private acceptNewConnection(newConnection: ManagedConnection): boolean {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
logger.trace(getNodeIdOrUnknownFromPeerDescriptor(newConnection.getPeerDescriptor())
|
|
422
|
-
+ ' acceptIncomingConnection() replace current connection')
|
|
412
|
+
const nodeId = getNodeIdFromPeerDescriptor(newConnection.getPeerDescriptor()!)
|
|
413
|
+
logger.trace(nodeId + ' acceptIncomingConnection()')
|
|
414
|
+
if (this.connections.has(nodeId)) {
|
|
415
|
+
if (getOfferer(getNodeIdFromPeerDescriptor(this.getLocalPeerDescriptor()), nodeId) === 'remote') {
|
|
416
|
+
logger.trace(nodeId + ' acceptIncomingConnection() replace current connection')
|
|
423
417
|
// replace the current connection
|
|
424
|
-
const oldConnection = this.connections.get(
|
|
425
|
-
logger.trace('replaced: ' +
|
|
418
|
+
const oldConnection = this.connections.get(nodeId)!
|
|
419
|
+
logger.trace('replaced: ' + nodeId)
|
|
426
420
|
const buffer = oldConnection.stealOutputBuffer()
|
|
427
|
-
|
|
421
|
+
|
|
428
422
|
for (const data of buffer) {
|
|
429
423
|
newConnection.sendNoWait(data)
|
|
430
424
|
}
|
|
431
|
-
|
|
425
|
+
|
|
432
426
|
oldConnection.reportBufferSentByOtherConnection()
|
|
433
427
|
oldConnection.replacedByOtherConnection = true
|
|
434
428
|
} else {
|
|
@@ -436,22 +430,22 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
436
430
|
}
|
|
437
431
|
}
|
|
438
432
|
|
|
439
|
-
logger.trace(
|
|
440
|
-
this.connections.set(
|
|
433
|
+
logger.trace(nodeId + ' added to connections at acceptIncomingConnection')
|
|
434
|
+
this.connections.set(nodeId, newConnection)
|
|
441
435
|
|
|
442
436
|
return true
|
|
443
437
|
}
|
|
444
438
|
|
|
445
439
|
private async closeConnection(peerDescriptor: PeerDescriptor, gracefulLeave: boolean, reason?: string): Promise<void> {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
this.locks.clearAllLocks(
|
|
449
|
-
if (this.connections.has(
|
|
450
|
-
const connectionToClose = this.connections.get(
|
|
440
|
+
const nodeId = getNodeIdFromPeerDescriptor(peerDescriptor)
|
|
441
|
+
logger.trace(nodeId + ' ' + 'closeConnection() ' + reason)
|
|
442
|
+
this.locks.clearAllLocks(nodeId)
|
|
443
|
+
if (this.connections.has(nodeId)) {
|
|
444
|
+
const connectionToClose = this.connections.get(nodeId)!
|
|
451
445
|
await connectionToClose.close(gracefulLeave)
|
|
452
446
|
|
|
453
447
|
} else {
|
|
454
|
-
logger.trace(
|
|
448
|
+
logger.trace(nodeId + ' ' + 'closeConnection() this.connections did not have the id')
|
|
455
449
|
this.emit('disconnected', peerDescriptor, false)
|
|
456
450
|
}
|
|
457
451
|
}
|
|
@@ -460,13 +454,14 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
460
454
|
if (this.state === ConnectionManagerState.STOPPED || areEqualPeerDescriptors(targetDescriptor, this.getLocalPeerDescriptor())) {
|
|
461
455
|
return
|
|
462
456
|
}
|
|
463
|
-
const
|
|
457
|
+
const nodeId = getNodeIdFromPeerDescriptor(targetDescriptor)
|
|
464
458
|
const rpcRemote = new ConnectionLockRpcRemote(
|
|
465
459
|
this.getLocalPeerDescriptor(),
|
|
466
460
|
targetDescriptor,
|
|
467
|
-
|
|
461
|
+
this.rpcCommunicator!,
|
|
462
|
+
ConnectionLockRpcClient
|
|
468
463
|
)
|
|
469
|
-
this.locks.addLocalLocked(
|
|
464
|
+
this.locks.addLocalLocked(nodeId, lockId)
|
|
470
465
|
rpcRemote.lockRequest(lockId)
|
|
471
466
|
.then((_accepted) => logger.trace('LockRequest successful'))
|
|
472
467
|
.catch((err) => { logger.debug(err) })
|
|
@@ -476,38 +471,36 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
476
471
|
if (this.state === ConnectionManagerState.STOPPED || areEqualPeerDescriptors(targetDescriptor, this.getLocalPeerDescriptor())) {
|
|
477
472
|
return
|
|
478
473
|
}
|
|
479
|
-
const
|
|
480
|
-
this.locks.removeLocalLocked(
|
|
474
|
+
const nodeId = getNodeIdFromPeerDescriptor(targetDescriptor)
|
|
475
|
+
this.locks.removeLocalLocked(nodeId, lockId)
|
|
481
476
|
const rpcRemote = new ConnectionLockRpcRemote(
|
|
482
477
|
this.getLocalPeerDescriptor(),
|
|
483
478
|
targetDescriptor,
|
|
484
|
-
|
|
479
|
+
this.rpcCommunicator!,
|
|
480
|
+
ConnectionLockRpcClient
|
|
485
481
|
)
|
|
486
|
-
if (this.connections.has(
|
|
482
|
+
if (this.connections.has(nodeId)) {
|
|
487
483
|
rpcRemote.unlockRequest(lockId)
|
|
488
484
|
}
|
|
489
485
|
}
|
|
490
486
|
|
|
491
|
-
public weakLockConnection(
|
|
492
|
-
if (this.state === ConnectionManagerState.STOPPED ||
|
|
487
|
+
public weakLockConnection(nodeId: DhtAddress, lockId: LockID): void {
|
|
488
|
+
if (this.state === ConnectionManagerState.STOPPED || (nodeId === getNodeIdFromPeerDescriptor(this.getLocalPeerDescriptor()))) {
|
|
493
489
|
return
|
|
494
490
|
}
|
|
495
|
-
|
|
496
|
-
this.locks.addWeakLocked(peerIdKey)
|
|
491
|
+
this.locks.addWeakLocked(nodeId, lockId)
|
|
497
492
|
}
|
|
498
493
|
|
|
499
|
-
public weakUnlockConnection(
|
|
500
|
-
if (this.state === ConnectionManagerState.STOPPED ||
|
|
494
|
+
public weakUnlockConnection(nodeId: DhtAddress, lockId: LockID): void {
|
|
495
|
+
if (this.state === ConnectionManagerState.STOPPED || (nodeId === getNodeIdFromPeerDescriptor(this.getLocalPeerDescriptor()))) {
|
|
501
496
|
return
|
|
502
497
|
}
|
|
503
|
-
|
|
504
|
-
this.locks.removeWeakLocked(peerIdKey)
|
|
505
|
-
|
|
498
|
+
this.locks.removeWeakLocked(nodeId, lockId)
|
|
506
499
|
}
|
|
507
500
|
|
|
508
501
|
private async gracefullyDisconnectAsync(targetDescriptor: PeerDescriptor, disconnectMode: DisconnectMode): Promise<void> {
|
|
509
502
|
|
|
510
|
-
const connection = this.connections.get(
|
|
503
|
+
const connection = this.connections.get(getNodeIdFromPeerDescriptor(targetDescriptor))
|
|
511
504
|
|
|
512
505
|
if (!connection) {
|
|
513
506
|
logger.debug('gracefullyDisconnectedAsync() tried on a non-existing connection')
|
|
@@ -515,6 +508,7 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
515
508
|
}
|
|
516
509
|
|
|
517
510
|
const promise = new Promise<void>((resolve, _reject) => {
|
|
511
|
+
// TODO use config option or named constant?
|
|
518
512
|
// eslint-disable-next-line promise/catch-or-return
|
|
519
513
|
waitForEvent3<ManagedConnectionEvents>(connection, 'disconnected', 2000).then(() => {
|
|
520
514
|
logger.trace('disconnected event received in gracefullyDisconnectAsync()')
|
|
@@ -522,6 +516,7 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
522
516
|
})
|
|
523
517
|
.catch((e) => {
|
|
524
518
|
logger.trace('force-closing connection after timeout ' + e)
|
|
519
|
+
// TODO should we have some handling for this floating promise?
|
|
525
520
|
connection.close(true)
|
|
526
521
|
})
|
|
527
522
|
.finally(() => {
|
|
@@ -530,30 +525,29 @@ export class ConnectionManager extends EventEmitter<TransportEvents> implements
|
|
|
530
525
|
})
|
|
531
526
|
})
|
|
532
527
|
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
.
|
|
536
|
-
|
|
537
|
-
})
|
|
538
|
-
|
|
539
|
-
await promise
|
|
528
|
+
await Promise.all([
|
|
529
|
+
promise,
|
|
530
|
+
this.doGracefullyDisconnectAsync(targetDescriptor, disconnectMode)
|
|
531
|
+
])
|
|
540
532
|
}
|
|
541
533
|
|
|
542
534
|
private async doGracefullyDisconnectAsync(targetDescriptor: PeerDescriptor, disconnectMode: DisconnectMode): Promise<void> {
|
|
543
|
-
|
|
535
|
+
const nodeId = getNodeIdFromPeerDescriptor(targetDescriptor)
|
|
536
|
+
logger.trace(nodeId + ' gracefullyDisconnectAsync()')
|
|
544
537
|
const rpcRemote = new ConnectionLockRpcRemote(
|
|
545
538
|
this.getLocalPeerDescriptor(),
|
|
546
539
|
targetDescriptor,
|
|
547
|
-
|
|
540
|
+
this.rpcCommunicator!,
|
|
541
|
+
ConnectionLockRpcClient
|
|
548
542
|
)
|
|
549
543
|
try {
|
|
550
544
|
await rpcRemote.gracefulDisconnect(disconnectMode)
|
|
551
545
|
} catch (ex) {
|
|
552
|
-
logger.trace(
|
|
546
|
+
logger.trace(nodeId + ' remote.gracefulDisconnect() failed' + ex)
|
|
553
547
|
}
|
|
554
548
|
}
|
|
555
549
|
|
|
556
|
-
public
|
|
550
|
+
public getConnections(): PeerDescriptor[] {
|
|
557
551
|
return Array.from(this.connections.values())
|
|
558
552
|
.filter((managedConnection: ManagedConnection) => managedConnection.isHandshakeCompleted())
|
|
559
553
|
.map((managedConnection: ManagedConnection) => managedConnection.getPeerDescriptor()!)
|
|
@@ -10,13 +10,14 @@ import { Simulator } from './simulator/Simulator'
|
|
|
10
10
|
import { SimulatorConnector } from './simulator/SimulatorConnector'
|
|
11
11
|
import { IceServer, WebrtcConnector } from './webrtc/WebrtcConnector'
|
|
12
12
|
import { WebsocketConnector, WebsocketConnectorConfig } from './websocket/WebsocketConnector'
|
|
13
|
+
import { DhtAddress } from '../identifiers'
|
|
13
14
|
|
|
14
15
|
export interface ConnectorFacade {
|
|
15
16
|
createConnection: (peerDescriptor: PeerDescriptor) => ManagedConnection
|
|
16
17
|
getLocalPeerDescriptor: () => PeerDescriptor | undefined
|
|
17
18
|
start: (
|
|
18
19
|
onNewConnection: (connection: ManagedConnection) => boolean,
|
|
19
|
-
|
|
20
|
+
hasConnection: (nodeId: DhtAddress) => boolean,
|
|
20
21
|
autoCertifierTransport: ITransport
|
|
21
22
|
) => Promise<void>
|
|
22
23
|
stop: () => Promise<void>
|
|
@@ -39,6 +40,7 @@ export interface DefaultConnectorFacadeConfig {
|
|
|
39
40
|
webrtcPortRange?: PortRange
|
|
40
41
|
maxMessageSize?: number
|
|
41
42
|
tlsCertificate?: TlsCertificate
|
|
43
|
+
// TODO explicit default value for "websocketServerEnableTls" or make it required
|
|
42
44
|
websocketServerEnableTls?: boolean
|
|
43
45
|
autoCertifierUrl?: string
|
|
44
46
|
autoCertifierConfigFile?: string
|
|
@@ -51,22 +53,21 @@ export class DefaultConnectorFacade implements ConnectorFacade {
|
|
|
51
53
|
private localPeerDescriptor?: PeerDescriptor
|
|
52
54
|
private websocketConnector?: WebsocketConnector
|
|
53
55
|
private webrtcConnector?: WebrtcConnector
|
|
54
|
-
|
|
55
56
|
constructor(config: DefaultConnectorFacadeConfig) {
|
|
56
57
|
this.config = config
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
async start(
|
|
60
61
|
onNewConnection: (connection: ManagedConnection) => boolean,
|
|
61
|
-
|
|
62
|
+
hasConnection: (nodeId: DhtAddress) => boolean,
|
|
62
63
|
autoCertifierTransport: ITransport
|
|
63
64
|
): Promise<void> {
|
|
64
65
|
logger.trace(`Creating WebsocketConnectorRpcLocal`)
|
|
65
66
|
const webSocketConnectorConfig = {
|
|
66
|
-
transport: this.config.transport
|
|
67
|
+
transport: this.config.transport,
|
|
67
68
|
// TODO should we use canConnect also for WebrtcConnector? (NET-1142)
|
|
68
|
-
canConnect: (peerDescriptor: PeerDescriptor) => canConnect(peerDescriptor),
|
|
69
69
|
onNewConnection,
|
|
70
|
+
hasConnection,
|
|
70
71
|
portRange: this.config.websocketPortRange,
|
|
71
72
|
host: this.config.websocketHost,
|
|
72
73
|
entrypoints: this.config.entryPoints,
|
|
@@ -80,7 +81,7 @@ export class DefaultConnectorFacade implements ConnectorFacade {
|
|
|
80
81
|
this.websocketConnector = new WebsocketConnector(webSocketConnectorConfig)
|
|
81
82
|
logger.trace(`Creating WebRtcConnectorRpcLocal`)
|
|
82
83
|
this.webrtcConnector = new WebrtcConnector({
|
|
83
|
-
transport: this.config.transport
|
|
84
|
+
transport: this.config.transport,
|
|
84
85
|
iceServers: this.config.iceServers,
|
|
85
86
|
allowPrivateAddresses: this.config.webrtcAllowPrivateAddresses,
|
|
86
87
|
bufferThresholdLow: this.config.webrtcDatachannelBufferThresholdLow,
|
|
@@ -101,8 +102,8 @@ export class DefaultConnectorFacade implements ConnectorFacade {
|
|
|
101
102
|
this.setLocalPeerDescriptor(localPeerDescriptor)
|
|
102
103
|
if (localPeerDescriptor.websocket && !this.config.tlsCertificate && this.config.websocketServerEnableTls) {
|
|
103
104
|
try {
|
|
104
|
-
await this.websocketConnector
|
|
105
|
-
const connectivityResponse = await this.websocketConnector
|
|
105
|
+
await this.websocketConnector.autoCertify()
|
|
106
|
+
const connectivityResponse = await this.websocketConnector.checkConnectivity(false)
|
|
106
107
|
const autocertifiedLocalPeerDescriptor = this.config.createLocalPeerDescriptor(connectivityResponse)
|
|
107
108
|
if (autocertifiedLocalPeerDescriptor.websocket !== undefined) {
|
|
108
109
|
this.setLocalPeerDescriptor(autocertifiedLocalPeerDescriptor)
|
|
@@ -114,7 +115,7 @@ export class DefaultConnectorFacade implements ConnectorFacade {
|
|
|
114
115
|
})
|
|
115
116
|
}
|
|
116
117
|
} catch (err) {
|
|
117
|
-
logger.warn('Failed to auto-certify, disabling WebSocket server TLS')
|
|
118
|
+
logger.warn('Failed to auto-certify, disabling WebSocket server TLS', { error: err })
|
|
118
119
|
await this.restartWebsocketConnector({
|
|
119
120
|
...webSocketConnectorConfig,
|
|
120
121
|
serverEnableTls: false
|