@streamr/dht 100.0.0-testnet-two.4 → 100.0.0-testnet-three.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/dist/package.json +8 -8
- 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 +3 -3
- package/dist/src/connection/ConnectionLockHandler.js +8 -10
- package/dist/src/connection/ConnectionLockHandler.js.map +1 -1
- package/dist/src/connection/ConnectionLockRpcLocal.js +5 -4
- package/dist/src/connection/ConnectionLockRpcLocal.js.map +1 -1
- package/dist/src/connection/ConnectionLockRpcRemote.js +4 -4
- package/dist/src/connection/ConnectionLockRpcRemote.js.map +1 -1
- package/dist/src/connection/ConnectionManager.d.ts +8 -8
- package/dist/src/connection/ConnectionManager.js +54 -55
- package/dist/src/connection/ConnectionManager.js.map +1 -1
- package/dist/src/connection/ConnectorFacade.d.ts +3 -2
- package/dist/src/connection/ConnectorFacade.js +7 -0
- package/dist/src/connection/ConnectorFacade.js.map +1 -1
- package/dist/src/connection/Handshaker.js +3 -1
- 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.js +23 -15
- package/dist/src/connection/ManagedConnection.js.map +1 -1
- package/dist/src/connection/ManagedWebrtcConnection.js.map +1 -1
- package/dist/src/connection/connectivityChecker.js.map +1 -1
- package/dist/src/connection/connectivityRequestHandler.js +5 -2
- package/dist/src/connection/connectivityRequestHandler.js.map +1 -1
- package/dist/src/connection/simulator/Simulator.js +32 -20
- package/dist/src/connection/simulator/Simulator.js.map +1 -1
- package/dist/src/connection/simulator/SimulatorConnection.js +13 -10
- package/dist/src/connection/simulator/SimulatorConnection.js.map +1 -1
- package/dist/src/connection/simulator/SimulatorConnector.js +9 -6
- 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 +1 -1
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js +26 -14
- package/dist/src/connection/webrtc/NodeWebrtcConnection.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnector.d.ts +0 -1
- package/dist/src/connection/webrtc/WebrtcConnector.js +18 -17
- package/dist/src/connection/webrtc/WebrtcConnector.js.map +1 -1
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js +10 -9
- package/dist/src/connection/webrtc/WebrtcConnectorRpcLocal.js.map +1 -1
- package/dist/src/connection/webrtc/iceServerAsString.js.map +1 -1
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js +3 -0
- package/dist/src/connection/websocket/AutoCertifierClientFacade.js.map +1 -1
- package/dist/src/connection/websocket/ClientWebsocket.js +7 -4
- package/dist/src/connection/websocket/ClientWebsocket.js.map +1 -1
- package/dist/src/connection/websocket/ServerWebsocket.d.ts +1 -0
- package/dist/src/connection/websocket/ServerWebsocket.js +22 -3
- package/dist/src/connection/websocket/ServerWebsocket.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketConnector.d.ts +2 -1
- package/dist/src/connection/websocket/WebsocketConnector.js +24 -15
- package/dist/src/connection/websocket/WebsocketConnector.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.d.ts +2 -1
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js +3 -1
- package/dist/src/connection/websocket/WebsocketConnectorRpcLocal.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.js +2 -2
- package/dist/src/connection/websocket/WebsocketConnectorRpcRemote.js.map +1 -1
- package/dist/src/connection/websocket/WebsocketServer.js +6 -3
- package/dist/src/connection/websocket/WebsocketServer.js.map +1 -1
- package/dist/src/dht/DhtNode.d.ts +18 -19
- package/dist/src/dht/DhtNode.js +56 -65
- package/dist/src/dht/DhtNode.js.map +1 -1
- package/dist/src/dht/DhtNodeRpcLocal.d.ts +1 -1
- package/dist/src/dht/DhtNodeRpcLocal.js +5 -4
- package/dist/src/dht/DhtNodeRpcLocal.js.map +1 -1
- package/dist/src/dht/DhtNodeRpcRemote.d.ts +2 -1
- package/dist/src/dht/DhtNodeRpcRemote.js +5 -3
- package/dist/src/dht/DhtNodeRpcRemote.js.map +1 -1
- package/dist/src/dht/ExternalApiRpcLocal.d.ts +1 -1
- package/dist/src/dht/ExternalApiRpcLocal.js +4 -3
- package/dist/src/dht/ExternalApiRpcLocal.js.map +1 -1
- package/dist/src/dht/ExternalApiRpcRemote.js.map +1 -1
- package/dist/src/dht/PeerManager.d.ts +5 -5
- package/dist/src/dht/PeerManager.js +31 -24
- package/dist/src/dht/PeerManager.js.map +1 -1
- package/dist/src/dht/contact/Contact.js +3 -2
- package/dist/src/dht/contact/Contact.js.map +1 -1
- package/dist/src/dht/contact/ContactList.js +9 -5
- package/dist/src/dht/contact/ContactList.js.map +1 -1
- package/dist/src/dht/contact/RandomContactList.js +1 -0
- package/dist/src/dht/contact/RandomContactList.js.map +1 -1
- package/dist/src/dht/contact/RpcRemote.d.ts +2 -1
- package/dist/src/dht/contact/RpcRemote.js +4 -0
- package/dist/src/dht/contact/RpcRemote.js.map +1 -1
- package/dist/src/dht/contact/SortedContactList.js +3 -2
- package/dist/src/dht/contact/SortedContactList.js.map +1 -1
- package/dist/src/dht/discovery/DiscoverySession.js +8 -8
- package/dist/src/dht/discovery/DiscoverySession.js.map +1 -1
- package/dist/src/dht/discovery/PeerDiscovery.d.ts +8 -2
- package/dist/src/dht/discovery/PeerDiscovery.js +26 -17
- package/dist/src/dht/discovery/PeerDiscovery.js.map +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.d.ts +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js +9 -9
- package/dist/src/dht/recursive-operation/RecursiveOperationManager.js.map +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js +3 -2
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcLocal.js.map +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js +6 -5
- package/dist/src/dht/recursive-operation/RecursiveOperationRpcRemote.js.map +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.d.ts +2 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js +26 -20
- package/dist/src/dht/recursive-operation/RecursiveOperationSession.js.map +1 -1
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.d.ts +4 -2
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js +5 -2
- package/dist/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.js.map +1 -1
- 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 +1 -1
- package/dist/src/dht/routing/Router.js +20 -15
- package/dist/src/dht/routing/Router.js.map +1 -1
- package/dist/src/dht/routing/RouterRpcLocal.js +4 -4
- package/dist/src/dht/routing/RouterRpcLocal.js.map +1 -1
- package/dist/src/dht/routing/RouterRpcRemote.js +11 -9
- package/dist/src/dht/routing/RouterRpcRemote.js.map +1 -1
- package/dist/src/dht/routing/RoutingSession.d.ts +2 -0
- package/dist/src/dht/routing/RoutingSession.js +27 -9
- package/dist/src/dht/routing/RoutingSession.js.map +1 -1
- package/dist/src/dht/store/LocalDataStore.js +5 -4
- package/dist/src/dht/store/LocalDataStore.js.map +1 -1
- package/dist/src/dht/store/StoreManager.js +8 -8
- package/dist/src/dht/store/StoreManager.js.map +1 -1
- package/dist/src/dht/store/StoreRpcLocal.js +1 -0
- package/dist/src/dht/store/StoreRpcLocal.js.map +1 -1
- package/dist/src/dht/store/StoreRpcRemote.js +3 -3
- package/dist/src/dht/store/StoreRpcRemote.js.map +1 -1
- package/dist/src/exports.d.ts +1 -4
- package/dist/src/exports.js +4 -7
- package/dist/src/exports.js.map +1 -1
- package/dist/src/helpers/AddressTools.js.map +1 -1
- package/dist/src/helpers/Connectivity.js.map +1 -1
- package/dist/src/helpers/MapWithTtl.js +2 -1
- package/dist/src/helpers/MapWithTtl.js.map +1 -1
- package/dist/src/helpers/createPeerDescriptor.d.ts +3 -0
- package/dist/src/helpers/createPeerDescriptor.js +56 -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/protoToString.js.map +1 -1
- package/dist/src/identifiers.d.ts +3 -0
- package/dist/src/identifiers.js +9 -1
- package/dist/src/identifiers.js.map +1 -1
- package/dist/src/proto/google/protobuf/any.d.ts +8 -5
- 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.d.ts +0 -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.d.ts +10 -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 +4 -5
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +38 -29
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +22 -12
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +11 -16
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +2 -3
- package/dist/src/proto/packages/proto-rpc/protos/ProtoRpc.js +1 -1
- package/dist/src/rpc-protocol/DhtCallContext.d.ts +0 -1
- package/dist/src/rpc-protocol/DhtCallContext.js +8 -0
- package/dist/src/rpc-protocol/DhtCallContext.js.map +1 -1
- package/dist/src/transport/ITransport.d.ts +1 -1
- package/dist/src/transport/ListeningRpcCommunicator.js +2 -0
- package/dist/src/transport/ListeningRpcCommunicator.js.map +1 -1
- package/dist/src/transport/RoutingRpcCommunicator.d.ts +2 -1
- package/dist/src/transport/RoutingRpcCommunicator.js +2 -0
- package/dist/src/transport/RoutingRpcCommunicator.js.map +1 -1
- package/package.json +8 -8
- package/protos/DhtRpc.proto +7 -4
- package/src/connection/Connection.ts +6 -1
- package/src/connection/ConnectionLockHandler.ts +3 -3
- package/src/connection/ConnectionLockRpcLocal.ts +1 -5
- package/src/connection/ConnectionLockRpcRemote.ts +1 -1
- package/src/connection/ConnectionManager.ts +24 -38
- package/src/connection/ConnectorFacade.ts +3 -2
- package/src/connection/IConnection.ts +2 -8
- package/src/connection/ManagedConnection.ts +3 -3
- package/src/connection/connectivityRequestHandler.ts +7 -3
- package/src/connection/simulator/Simulator.ts +1 -2
- package/src/connection/simulator/SimulatorConnection.ts +1 -1
- package/src/connection/simulator/SimulatorConnector.ts +1 -2
- package/src/connection/webrtc/BrowserWebrtcConnection.ts +4 -3
- package/src/connection/webrtc/NodeWebrtcConnection.ts +5 -4
- package/src/connection/webrtc/WebrtcConnector.ts +9 -17
- package/src/connection/webrtc/WebrtcConnectorRpcLocal.ts +7 -7
- package/src/connection/websocket/ClientWebsocket.ts +3 -2
- package/src/connection/websocket/ServerWebsocket.ts +17 -1
- package/src/connection/websocket/WebsocketConnector.ts +10 -9
- package/src/connection/websocket/WebsocketConnectorRpcLocal.ts +4 -2
- package/src/connection/websocket/WebsocketConnectorRpcRemote.ts +1 -1
- package/src/connection/websocket/WebsocketServer.ts +2 -2
- package/src/dht/DhtNode.ts +63 -86
- package/src/dht/DhtNodeRpcLocal.ts +5 -5
- package/src/dht/DhtNodeRpcRemote.ts +3 -3
- package/src/dht/ExternalApiRpcLocal.ts +3 -4
- package/src/dht/PeerManager.ts +14 -20
- package/src/dht/contact/Contact.ts +1 -2
- package/src/dht/contact/RpcRemote.ts +2 -1
- package/src/dht/discovery/DiscoverySession.ts +2 -3
- package/src/dht/discovery/PeerDiscovery.ts +16 -9
- package/src/dht/recursive-operation/RecursiveOperationManager.ts +12 -6
- package/src/dht/recursive-operation/RecursiveOperationRpcLocal.ts +1 -1
- package/src/dht/recursive-operation/RecursiveOperationRpcRemote.ts +3 -2
- package/src/dht/recursive-operation/RecursiveOperationSession.ts +19 -9
- package/src/dht/recursive-operation/RecursiveOperationSessionRpcLocal.ts +13 -3
- package/src/dht/routing/DuplicateDetector.ts +9 -21
- package/src/dht/routing/Router.ts +12 -11
- package/src/dht/routing/RouterRpcLocal.ts +1 -2
- package/src/dht/routing/RouterRpcRemote.ts +5 -5
- package/src/dht/routing/RoutingSession.ts +22 -2
- package/src/dht/store/StoreManager.ts +1 -2
- package/src/dht/store/StoreRpcRemote.ts +1 -1
- package/src/exports.ts +9 -4
- package/src/helpers/createPeerDescriptor.ts +56 -0
- package/src/helpers/createPeerDescriptorSignaturePayload.ts +28 -0
- package/src/helpers/offering.ts +15 -0
- package/src/identifiers.ts +10 -1
- package/src/proto/google/protobuf/any.ts +12 -9
- package/src/proto/google/protobuf/empty.ts +2 -5
- package/src/proto/google/protobuf/timestamp.ts +14 -5
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +6 -7
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +3 -4
- package/src/proto/packages/dht/protos/DhtRpc.ts +32 -20
- package/src/proto/packages/proto-rpc/protos/ProtoRpc.ts +1 -1
- package/src/rpc-protocol/DhtCallContext.ts +0 -1
- package/src/transport/ITransport.ts +1 -1
- package/src/transport/RoutingRpcCommunicator.ts +1 -1
- package/test/benchmark/Find.test.ts +6 -8
- package/test/benchmark/KademliaCorrectness.test.ts +2 -3
- package/test/benchmark/SortedContactListBenchmark.test.ts +16 -16
- package/test/benchmark/WebsocketServerMemoryLeak.test.ts +1 -1
- package/test/benchmark/kademlia-simulation/KademliaSimulation.ts +8 -8
- package/test/benchmark/kademlia-simulation/SimulationNode.ts +8 -8
- package/test/end-to-end/Layer0-Layer1.test.ts +1 -1
- package/test/end-to-end/Layer0.test.ts +4 -4
- package/test/end-to-end/Layer0MixedConnectionTypes.test.ts +12 -12
- package/test/end-to-end/Layer0Webrtc-Layer1.test.ts +18 -18
- package/test/end-to-end/Layer0Webrtc.test.ts +13 -10
- package/test/end-to-end/Layer1-Scale-WebSocket.test.ts +2 -2
- package/test/end-to-end/Layer1-Scale-Webrtc.test.ts +2 -2
- package/test/end-to-end/RecoveryFromFailedAutoCertification.test.ts +1 -1
- package/test/end-to-end/WebsocketConnectionRequest.test.ts +3 -3
- package/test/end-to-end/memory-leak.test.ts +2 -2
- package/test/integration/ConnectionLocking.test.ts +60 -47
- package/test/integration/ConnectionManager.test.ts +8 -7
- package/test/integration/DhtJoinPeerDiscovery.test.ts +2 -2
- package/test/integration/DhtNodeExternalAPI.test.ts +1 -2
- package/test/integration/DhtNodeRpcRemote.test.ts +4 -3
- package/test/integration/DhtRpc.test.ts +4 -3
- package/test/integration/Find.test.ts +4 -6
- package/test/integration/Layer1-scale.test.ts +7 -7
- package/test/integration/Mock-Layer1-Layer0.test.ts +21 -24
- package/test/integration/MultipleEntryPointJoining.test.ts +7 -7
- package/test/integration/ReplicateData.test.ts +52 -161
- package/test/integration/RouteMessage.test.ts +24 -47
- package/test/integration/RouterRpcRemote.test.ts +7 -4
- package/test/integration/ScaleDownDht.test.ts +2 -3
- package/test/integration/SimultaneousConnections.test.ts +9 -8
- package/test/integration/Store.test.ts +1 -2
- package/test/integration/StoreAndDelete.test.ts +5 -0
- package/test/integration/StoreOnDhtWithThreeNodes.test.ts +59 -0
- package/test/integration/StoreOnDhtWithTwoNodes.test.ts +1 -1
- package/test/integration/StoreRpcRemote.test.ts +4 -4
- package/test/integration/WebrtcConnectionManagement.test.ts +6 -5
- package/test/integration/WebrtcConnectorRpc.test.ts +3 -2
- package/test/integration/WebsocketConnectionManagement.test.ts +27 -15
- package/test/integration/WebsocketConnectorRpc.test.ts +3 -2
- package/test/integration/{RpcErrors.test.ts → rpc-connections-over-webrpc.test.ts} +6 -3
- package/test/unit/DuplicateDetector.test.ts +2 -2
- package/test/unit/LocalDataStore.test.ts +1 -4
- package/test/unit/RandomContactList.test.ts +2 -4
- package/test/unit/RecursiveOperationManager.test.ts +5 -6
- package/test/unit/RecursiveOperationSession.test.ts +5 -4
- package/test/unit/Router.test.ts +25 -8
- package/test/unit/RoutingSession.test.ts +3 -3
- package/test/unit/SortedContactList.test.ts +2 -4
- package/test/unit/connectivityRequestHandler.test.ts +5 -3
- package/test/unit/createPeerDescriptor.test.ts +63 -0
- package/test/utils/FakeTransport.ts +7 -4
- package/test/utils/mock/Transport.ts +1 -1
- package/test/utils/utils.ts +6 -6
- package/dist/src/helpers/PeerID.d.ts +0 -27
- package/dist/src/helpers/PeerID.js +0 -87
- 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/peerIdFromPeerDescriptor.d.ts +0 -7
- package/dist/src/helpers/peerIdFromPeerDescriptor.js +0 -23
- package/dist/src/helpers/peerIdFromPeerDescriptor.js.map +0 -1
- package/src/helpers/PeerID.ts +0 -97
- package/src/helpers/UUID.ts +0 -35
- package/src/helpers/peerIdFromPeerDescriptor.ts +0 -20
- package/test/unit/PeerID.test.ts +0 -22
- package/test/unit/UUID.test.ts +0 -55
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import KBucket from 'k-bucket'
|
|
4
4
|
import { SortedContactList } from '../../src/dht/contact/SortedContactList'
|
|
5
|
-
import
|
|
6
|
-
import { DhtAddress, DhtAddressRaw, getDhtAddressFromRaw } from '../../src/identifiers'
|
|
5
|
+
import { DhtAddress, DhtAddressRaw, createRandomDhtAddress, getRawFromDhtAddress } from '../../src/identifiers'
|
|
7
6
|
|
|
8
7
|
const NUM_ADDS = 1000
|
|
9
8
|
|
|
@@ -14,10 +13,11 @@ interface Item {
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
const createRandomItem = (index: number): Item => {
|
|
17
|
-
const
|
|
16
|
+
const nodeId = createRandomDhtAddress()
|
|
17
|
+
const nodeIdRaw = getRawFromDhtAddress(nodeId)
|
|
18
18
|
return {
|
|
19
|
-
getNodeId: () =>
|
|
20
|
-
id:
|
|
19
|
+
getNodeId: () => nodeId,
|
|
20
|
+
id: nodeIdRaw,
|
|
21
21
|
vectorClock: index
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -32,13 +32,13 @@ function shuffleArray<T>(array: T[]): T[] {
|
|
|
32
32
|
|
|
33
33
|
describe('SortedContactListBenchmark', () => {
|
|
34
34
|
|
|
35
|
-
it('adds ' + NUM_ADDS + ' random
|
|
35
|
+
it('adds ' + NUM_ADDS + ' random nodeIds', async () => {
|
|
36
36
|
const randomIds = []
|
|
37
37
|
for (let i = 0; i < NUM_ADDS; i++) {
|
|
38
38
|
randomIds.push(createRandomItem(i))
|
|
39
39
|
}
|
|
40
40
|
const list = new SortedContactList({
|
|
41
|
-
referenceId:
|
|
41
|
+
referenceId: createRandomDhtAddress(),
|
|
42
42
|
allowToContainReferenceId: true,
|
|
43
43
|
emitEvents: true
|
|
44
44
|
})
|
|
@@ -50,7 +50,7 @@ describe('SortedContactListBenchmark', () => {
|
|
|
50
50
|
console.timeEnd('SortedContactList.addContact() with emitEvents=true')
|
|
51
51
|
|
|
52
52
|
const list2 = new SortedContactList({
|
|
53
|
-
referenceId:
|
|
53
|
+
referenceId: createRandomDhtAddress(),
|
|
54
54
|
allowToContainReferenceId: true,
|
|
55
55
|
emitEvents: false
|
|
56
56
|
})
|
|
@@ -61,7 +61,7 @@ describe('SortedContactListBenchmark', () => {
|
|
|
61
61
|
}
|
|
62
62
|
console.timeEnd('SortedContactList.addContact() with emitEvents=false')
|
|
63
63
|
|
|
64
|
-
const kBucket = new KBucket<Item>({ localNodeId:
|
|
64
|
+
const kBucket = new KBucket<Item>({ localNodeId: getRawFromDhtAddress(createRandomDhtAddress()) })
|
|
65
65
|
console.time('KBucket.add()')
|
|
66
66
|
for (let i = 0; i < NUM_ADDS; i++) {
|
|
67
67
|
kBucket.add(randomIds[i])
|
|
@@ -77,14 +77,14 @@ describe('SortedContactListBenchmark', () => {
|
|
|
77
77
|
|
|
78
78
|
console.time('kBucket closest()')
|
|
79
79
|
for (let i = 0; i < NUM_ADDS; i++) {
|
|
80
|
-
kBucket.closest(
|
|
80
|
+
kBucket.closest(getRawFromDhtAddress(createRandomDhtAddress()), 20)
|
|
81
81
|
}
|
|
82
82
|
console.timeEnd('kBucket closest()')
|
|
83
83
|
|
|
84
84
|
console.time('SortedContactList.getClosestContacts() with emitEvents=true')
|
|
85
85
|
for (let i = 0; i < NUM_ADDS; i++) {
|
|
86
86
|
const closest = new SortedContactList<Item>({
|
|
87
|
-
referenceId:
|
|
87
|
+
referenceId: createRandomDhtAddress(),
|
|
88
88
|
allowToContainReferenceId: true,
|
|
89
89
|
emitEvents: true
|
|
90
90
|
})
|
|
@@ -98,7 +98,7 @@ describe('SortedContactListBenchmark', () => {
|
|
|
98
98
|
console.time('SortedContactList.getClosestContacts() with emitEvents=false')
|
|
99
99
|
for (let i = 0; i < NUM_ADDS; i++) {
|
|
100
100
|
const closest = new SortedContactList<Item>({
|
|
101
|
-
referenceId:
|
|
101
|
+
referenceId: createRandomDhtAddress(),
|
|
102
102
|
allowToContainReferenceId: true,
|
|
103
103
|
emitEvents: false
|
|
104
104
|
})
|
|
@@ -112,7 +112,7 @@ describe('SortedContactListBenchmark', () => {
|
|
|
112
112
|
console.time('SortedContactList.getClosestContacts() with emitEvents=false and lodash')
|
|
113
113
|
for (let i = 0; i < NUM_ADDS; i++) {
|
|
114
114
|
const closest = new SortedContactList<Item>({
|
|
115
|
-
referenceId:
|
|
115
|
+
referenceId: createRandomDhtAddress(),
|
|
116
116
|
allowToContainReferenceId: true,
|
|
117
117
|
emitEvents: false
|
|
118
118
|
})
|
|
@@ -126,7 +126,7 @@ describe('SortedContactListBenchmark', () => {
|
|
|
126
126
|
console.time('SortedContactList.getClosestContacts() with emitEvents=false and addContacts()')
|
|
127
127
|
for (let i = 0; i < NUM_ADDS; i++) {
|
|
128
128
|
const closest = new SortedContactList<Item>({
|
|
129
|
-
referenceId:
|
|
129
|
+
referenceId: createRandomDhtAddress(),
|
|
130
130
|
allowToContainReferenceId: true,
|
|
131
131
|
emitEvents: false
|
|
132
132
|
})
|
|
@@ -140,10 +140,10 @@ describe('SortedContactListBenchmark', () => {
|
|
|
140
140
|
const shuffled = shuffleArray(kBucket.toArray())
|
|
141
141
|
console.time('kbucket add and closest')
|
|
142
142
|
for (let i = 0; i < NUM_ADDS; i++) {
|
|
143
|
-
const bucket2 = new KBucket<Item>({ localNodeId:
|
|
143
|
+
const bucket2 = new KBucket<Item>({ localNodeId: getRawFromDhtAddress(createRandomDhtAddress()) })
|
|
144
144
|
|
|
145
145
|
shuffled.forEach((contact) => bucket2.add(contact))
|
|
146
|
-
bucket2.closest(
|
|
146
|
+
bucket2.closest(getRawFromDhtAddress(createRandomDhtAddress()), 20)
|
|
147
147
|
}
|
|
148
148
|
console.timeEnd('kbucket add and closest')
|
|
149
149
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { wait } from '@streamr/utils'
|
|
4
4
|
import { WebsocketServer } from '../../src/connection/websocket/WebsocketServer'
|
|
5
|
-
import { ClientWebsocket } from '../../src/
|
|
5
|
+
import { ClientWebsocket } from '../../src/connection/websocket/ClientWebsocket'
|
|
6
6
|
|
|
7
7
|
// This 'test' is meant to be run manually using the following command:
|
|
8
8
|
// node --inspect ../../../../node_modules/.bin/jest WebsocketServerMemoryLeak.test.ts
|
|
@@ -42,17 +42,17 @@ export class KademliaSimulation {
|
|
|
42
42
|
|
|
43
43
|
for (let i = this.nodes.length - 1; i >= 0; i--) {
|
|
44
44
|
|
|
45
|
-
const
|
|
45
|
+
const outgoingRpcCallCount = this.nodes[i].getOutgoingRpcCallCount()
|
|
46
46
|
console.log('-----------')
|
|
47
47
|
console.log('Node: ' + i)
|
|
48
48
|
console.log('Kbucket size: ' + this.nodes[i].getKBucketSize())
|
|
49
|
-
console.log('Num incoming RPC calls: ' + this.nodes[i].
|
|
50
|
-
console.log('Num outgoing RPC calls: ' +
|
|
49
|
+
console.log('Num incoming RPC calls: ' + this.nodes[i].getIncomingRpcCallCount())
|
|
50
|
+
console.log('Num outgoing RPC calls: ' + outgoingRpcCallCount)
|
|
51
51
|
|
|
52
|
-
sumOutgoingRpcCalls +=
|
|
52
|
+
sumOutgoingRpcCalls += outgoingRpcCallCount
|
|
53
53
|
|
|
54
|
-
if (maxOutgoingRpcCalls <
|
|
55
|
-
maxOutgoingRpcCalls =
|
|
54
|
+
if (maxOutgoingRpcCalls < outgoingRpcCallCount) {
|
|
55
|
+
maxOutgoingRpcCalls = outgoingRpcCallCount
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
const kademliaNeighbors = this.nodes[i].getNeightborList().getContactIds()
|
|
@@ -79,13 +79,13 @@ export class KademliaSimulation {
|
|
|
79
79
|
|
|
80
80
|
const avgCorrectNeighbors = sumCorrectNeighbors / (KademliaSimulation.NUM_NODES - 1)
|
|
81
81
|
const avgKbucketSize = sumKbucketSize / (KademliaSimulation.NUM_NODES - 1)
|
|
82
|
-
const
|
|
82
|
+
const avgOutgoingRpcCallCount = sumOutgoingRpcCalls / (KademliaSimulation.NUM_NODES - 1)
|
|
83
83
|
|
|
84
84
|
console.log('----------- Simulation results ------------------')
|
|
85
85
|
console.log('Minimum correct neighbors: ' + minimumCorrectNeighbors)
|
|
86
86
|
console.log('Average correct neighbors: ' + avgCorrectNeighbors)
|
|
87
87
|
console.log('Average Kbucket size: ' + avgKbucketSize)
|
|
88
|
-
console.log('Average number of outgoing RPC calls: ' +
|
|
88
|
+
console.log('Average number of outgoing RPC calls: ' + avgOutgoingRpcCallCount)
|
|
89
89
|
console.log('MAX number of outgoing RPC calls: ' + maxOutgoingRpcCalls)
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -12,8 +12,8 @@ export class SimulationNode {
|
|
|
12
12
|
private bucket: KBucket<Contact>
|
|
13
13
|
private ownContact: Contact
|
|
14
14
|
|
|
15
|
-
private
|
|
16
|
-
private
|
|
15
|
+
private incomingRpcCallCount = 0
|
|
16
|
+
private outgoingRpcCallCount = 0
|
|
17
17
|
|
|
18
18
|
private neighborList: SortedContactList<Contact>
|
|
19
19
|
private ownId: DhtAddress
|
|
@@ -47,18 +47,18 @@ export class SimulationNode {
|
|
|
47
47
|
return this.bucket.count()
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
public
|
|
51
|
-
return this.
|
|
50
|
+
public getIncomingRpcCallCount(): number {
|
|
51
|
+
return this.incomingRpcCallCount
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
public
|
|
55
|
-
return this.
|
|
54
|
+
public getOutgoingRpcCallCount(): number {
|
|
55
|
+
return this.outgoingRpcCallCount
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// RPC call
|
|
59
59
|
|
|
60
60
|
public getClosestNodesTo(id: DhtAddress, caller: SimulationNode): Contact[] {
|
|
61
|
-
this.
|
|
61
|
+
this.incomingRpcCallCount++
|
|
62
62
|
const idValue = getRawFromDhtAddress(id)
|
|
63
63
|
const ret = this.bucket.closest(idValue)
|
|
64
64
|
if (!this.bucket.get(idValue)) {
|
|
@@ -73,7 +73,7 @@ export class SimulationNode {
|
|
|
73
73
|
contactList.forEach((contact) => {
|
|
74
74
|
shortlist.setContacted(contact.getNodeId())
|
|
75
75
|
shortlist.setActive(contact.getNodeId())
|
|
76
|
-
this.
|
|
76
|
+
this.outgoingRpcCallCount++
|
|
77
77
|
const returnedContacts = contact.dhtNode!.getClosestNodesTo(this.ownId, this)
|
|
78
78
|
shortlist.addContacts(returnedContacts)
|
|
79
79
|
returnedContacts.forEach((returnedContact: Contact) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DhtNode } from '../../src/dht/DhtNode'
|
|
2
|
-
import { areEqualPeerDescriptors } from '../../src/
|
|
2
|
+
import { areEqualPeerDescriptors } from '../../src/identifiers'
|
|
3
3
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
4
4
|
|
|
5
5
|
const STREAM_ID1 = 'stream1'
|
|
@@ -68,9 +68,9 @@ describe('Layer0', () => {
|
|
|
68
68
|
node4.joinDht([epDhtNode.getLocalPeerDescriptor()])
|
|
69
69
|
])
|
|
70
70
|
|
|
71
|
-
expect(node1.
|
|
72
|
-
expect(node2.
|
|
73
|
-
expect(node3.
|
|
74
|
-
expect(node4.
|
|
71
|
+
expect(node1.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
72
|
+
expect(node2.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
73
|
+
expect(node3.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
74
|
+
expect(node4.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
75
75
|
}, 10000)
|
|
76
76
|
})
|
|
@@ -87,13 +87,13 @@ describe('Layer0MixedConnectionTypes', () => {
|
|
|
87
87
|
node5.joinDht([epPeerDescriptor])
|
|
88
88
|
])
|
|
89
89
|
|
|
90
|
-
expect(node1.
|
|
91
|
-
expect(node2.
|
|
92
|
-
expect(node3.
|
|
93
|
-
expect(node4.
|
|
94
|
-
expect(node5.
|
|
90
|
+
expect(node1.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
91
|
+
expect(node2.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
92
|
+
expect(node3.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
93
|
+
expect(node4.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
94
|
+
expect(node5.getNeighborCount()).toBeGreaterThanOrEqual(1)
|
|
95
95
|
|
|
96
|
-
},
|
|
96
|
+
}, 20000)
|
|
97
97
|
|
|
98
98
|
it('Simultaneous joins', async () => {
|
|
99
99
|
await Promise.all([
|
|
@@ -103,10 +103,10 @@ describe('Layer0MixedConnectionTypes', () => {
|
|
|
103
103
|
node4.joinDht([epPeerDescriptor]),
|
|
104
104
|
node5.joinDht([epPeerDescriptor])
|
|
105
105
|
])
|
|
106
|
-
expect(node1.
|
|
107
|
-
expect(node2.
|
|
108
|
-
expect(node3.
|
|
109
|
-
expect(node4.
|
|
110
|
-
expect(node5.
|
|
111
|
-
},
|
|
106
|
+
expect(node1.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
107
|
+
expect(node2.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
108
|
+
expect(node3.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
109
|
+
expect(node4.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
110
|
+
expect(node5.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
111
|
+
}, 40000)
|
|
112
112
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DhtNode } from '../../src/dht/DhtNode'
|
|
2
|
+
import { DhtAddress, getNodeIdFromPeerDescriptor } from '../../src/identifiers'
|
|
2
3
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
3
|
-
import { getNodeIdFromPeerDescriptor } from '../../src/exports'
|
|
4
4
|
|
|
5
5
|
describe('Layer 1 on Layer 0 with mocked connections', () => {
|
|
6
6
|
|
|
@@ -26,52 +26,52 @@ describe('Layer 1 on Layer 0 with mocked connections', () => {
|
|
|
26
26
|
|
|
27
27
|
layer0EntryPoint = new DhtNode({ peerDescriptor: entrypointDescriptor, websocketServerEnableTls: false })
|
|
28
28
|
|
|
29
|
-
const layer0Node1Id = '11'
|
|
29
|
+
const layer0Node1Id = '11' as DhtAddress
|
|
30
30
|
layer0Node1 = new DhtNode({
|
|
31
|
-
|
|
31
|
+
nodeId: layer0Node1Id
|
|
32
32
|
})
|
|
33
33
|
|
|
34
|
-
const layer0Node2Id = '22'
|
|
34
|
+
const layer0Node2Id = '22' as DhtAddress
|
|
35
35
|
layer0Node2 = new DhtNode({
|
|
36
|
-
|
|
36
|
+
nodeId: layer0Node2Id
|
|
37
37
|
})
|
|
38
38
|
|
|
39
|
-
const layer0Node3Id = '33'
|
|
39
|
+
const layer0Node3Id = '33' as DhtAddress
|
|
40
40
|
layer0Node3 = new DhtNode({
|
|
41
|
-
|
|
41
|
+
nodeId: layer0Node3Id
|
|
42
42
|
})
|
|
43
43
|
|
|
44
|
-
const layer0Node4Id = '44'
|
|
44
|
+
const layer0Node4Id = '44' as DhtAddress
|
|
45
45
|
layer0Node4 = new DhtNode({
|
|
46
|
-
|
|
46
|
+
nodeId: layer0Node4Id
|
|
47
47
|
})
|
|
48
48
|
|
|
49
49
|
layer1EntryPoint = new DhtNode({
|
|
50
|
-
|
|
50
|
+
nodeId: getNodeIdFromPeerDescriptor(entrypointDescriptor),
|
|
51
51
|
transport: layer0EntryPoint,
|
|
52
52
|
serviceId: 'layer1'
|
|
53
53
|
})
|
|
54
54
|
|
|
55
55
|
layer1Node1 = new DhtNode({
|
|
56
|
-
|
|
56
|
+
nodeId: layer0Node1Id,
|
|
57
57
|
transport: layer0Node1,
|
|
58
58
|
serviceId: 'layer1'
|
|
59
59
|
})
|
|
60
60
|
|
|
61
61
|
layer1Node2 = new DhtNode({
|
|
62
|
-
|
|
62
|
+
nodeId: layer0Node2Id,
|
|
63
63
|
transport: layer0Node2,
|
|
64
64
|
serviceId: 'layer1'
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
layer1Node3 = new DhtNode({
|
|
68
|
-
|
|
68
|
+
nodeId: layer0Node3Id,
|
|
69
69
|
transport: layer0Node3,
|
|
70
70
|
serviceId: 'layer1'
|
|
71
71
|
})
|
|
72
72
|
|
|
73
73
|
layer1Node4 = new DhtNode({
|
|
74
|
-
|
|
74
|
+
nodeId: layer0Node4Id,
|
|
75
75
|
transport: layer0Node4,
|
|
76
76
|
serviceId: 'layer1'
|
|
77
77
|
})
|
|
@@ -119,9 +119,9 @@ describe('Layer 1 on Layer 0 with mocked connections', () => {
|
|
|
119
119
|
await layer1Node3.joinDht([entrypointDescriptor])
|
|
120
120
|
await layer1Node4.joinDht([entrypointDescriptor])
|
|
121
121
|
|
|
122
|
-
expect(layer1Node1.
|
|
123
|
-
expect(layer1Node2.
|
|
124
|
-
expect(layer1Node3.
|
|
125
|
-
expect(layer1Node4.
|
|
122
|
+
expect(layer1Node1.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
123
|
+
expect(layer1Node2.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
124
|
+
expect(layer1Node3.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
125
|
+
expect(layer1Node4.getNeighborCount()).toBeGreaterThanOrEqual(2)
|
|
126
126
|
}, 60000)
|
|
127
127
|
})
|
|
@@ -4,6 +4,7 @@ import { ConnectionType } from '../../src/connection/IConnection'
|
|
|
4
4
|
import { DhtNode } from '../../src/dht/DhtNode'
|
|
5
5
|
import { PeerDescriptor } from '../../src/proto/packages/dht/protos/DhtRpc'
|
|
6
6
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
7
|
+
import { getNodeIdFromPeerDescriptor } from '../../src/exports'
|
|
7
8
|
|
|
8
9
|
describe('Layer0 with WebRTC connections', () => {
|
|
9
10
|
|
|
@@ -66,12 +67,13 @@ describe('Layer0 with WebRTC connections', () => {
|
|
|
66
67
|
node2.joinDht([epPeerDescriptor]),
|
|
67
68
|
node1.joinDht([epPeerDescriptor])
|
|
68
69
|
])
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
expect((
|
|
72
|
-
expect((
|
|
70
|
+
const nodeId1 = getNodeIdFromPeerDescriptor(node1.getLocalPeerDescriptor())
|
|
71
|
+
const nodeId2 = getNodeIdFromPeerDescriptor(node2.getLocalPeerDescriptor())
|
|
72
|
+
expect((node1.getTransport() as ConnectionManager).hasConnection(nodeId2)).toEqual(true)
|
|
73
|
+
expect((node2.getTransport() as ConnectionManager).hasConnection(nodeId1)).toEqual(true)
|
|
74
|
+
expect((node1.getTransport() as ConnectionManager).getConnection(nodeId2)!.connectionType)
|
|
73
75
|
.toEqual(ConnectionType.WEBRTC)
|
|
74
|
-
expect((node2.getTransport() as ConnectionManager).getConnection(
|
|
76
|
+
expect((node2.getTransport() as ConnectionManager).getConnection(nodeId1)!.connectionType)
|
|
75
77
|
.toEqual(ConnectionType.WEBRTC)
|
|
76
78
|
|
|
77
79
|
}, 60000)
|
|
@@ -83,12 +85,13 @@ describe('Layer0 with WebRTC connections', () => {
|
|
|
83
85
|
node3.joinDht([epPeerDescriptor]),
|
|
84
86
|
node4.joinDht([epPeerDescriptor])
|
|
85
87
|
])
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
expect((
|
|
89
|
-
expect((
|
|
88
|
+
const nodeId1 = getNodeIdFromPeerDescriptor(node1.getLocalPeerDescriptor())
|
|
89
|
+
const nodeId2 = getNodeIdFromPeerDescriptor(node2.getLocalPeerDescriptor())
|
|
90
|
+
expect((node1.getTransport() as ConnectionManager).hasConnection(nodeId2)).toEqual(true)
|
|
91
|
+
expect((node2.getTransport() as ConnectionManager).hasConnection(nodeId1)).toEqual(true)
|
|
92
|
+
expect((node1.getTransport() as ConnectionManager).getConnection(nodeId2)!.connectionType)
|
|
90
93
|
.toEqual(ConnectionType.WEBRTC)
|
|
91
|
-
expect((node2.getTransport() as ConnectionManager).getConnection(
|
|
94
|
+
expect((node2.getTransport() as ConnectionManager).getConnection(nodeId1)!.connectionType)
|
|
92
95
|
.toEqual(ConnectionType.WEBRTC)
|
|
93
96
|
})
|
|
94
97
|
})
|
|
@@ -67,10 +67,10 @@ describe('Layer1 Scale', () => {
|
|
|
67
67
|
// TODO: fix flaky test in NET-1021
|
|
68
68
|
it('bucket sizes', async () => {
|
|
69
69
|
layer0Nodes.forEach((node) => {
|
|
70
|
-
expect(node.
|
|
70
|
+
expect(node.getNeighborCount()).toBeGreaterThanOrEqual(NUM_OF_NODES_PER_KBUCKET - 1)
|
|
71
71
|
})
|
|
72
72
|
layer1Nodes.forEach((node ) => {
|
|
73
|
-
expect(node.
|
|
73
|
+
expect(node.getNeighborCount()).toBeGreaterThanOrEqual(NUM_OF_NODES_PER_KBUCKET / 2)
|
|
74
74
|
})
|
|
75
75
|
})
|
|
76
76
|
})
|
|
@@ -58,10 +58,10 @@ describe('Layer1 Scale', () => {
|
|
|
58
58
|
|
|
59
59
|
it('bucket sizes', async () => {
|
|
60
60
|
layer0Nodes.forEach((node) => {
|
|
61
|
-
expect(node.
|
|
61
|
+
expect(node.getNeighborCount()).toBeGreaterThanOrEqual(NUM_OF_NODES_PER_KBUCKET - 1)
|
|
62
62
|
})
|
|
63
63
|
layer1Nodes.forEach((node) => {
|
|
64
|
-
expect(node.
|
|
64
|
+
expect(node.getNeighborCount()).toBeGreaterThanOrEqual(NUM_OF_NODES_PER_KBUCKET / 2)
|
|
65
65
|
})
|
|
66
66
|
})
|
|
67
67
|
})
|
|
@@ -46,7 +46,7 @@ describe('Failed autocertification', () => {
|
|
|
46
46
|
const failedAutocertificationPeerDescriptor = failedAutocertificationNode.getLocalPeerDescriptor()
|
|
47
47
|
expect(failedAutocertificationPeerDescriptor.websocket!.tls).toBe(false)
|
|
48
48
|
await failedAutocertificationNode.joinDht([entryPointPeerDescriptor])
|
|
49
|
-
expect(failedAutocertificationNode.
|
|
49
|
+
expect(failedAutocertificationNode.getNeighborCount()).toEqual(2)
|
|
50
50
|
})
|
|
51
51
|
|
|
52
52
|
})
|
|
@@ -2,8 +2,8 @@ import { PeerDescriptor } from '../../src/proto/packages/dht/protos/DhtRpc'
|
|
|
2
2
|
import { DhtNode } from '../../src/dht/DhtNode'
|
|
3
3
|
import { ConnectionManager } from '../../src/connection/ConnectionManager'
|
|
4
4
|
import { waitForCondition } from '@streamr/utils'
|
|
5
|
-
import { areEqualPeerDescriptors } from '../../src/helpers/peerIdFromPeerDescriptor'
|
|
6
5
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
6
|
+
import { areEqualPeerDescriptors } from '../../src/identifiers'
|
|
7
7
|
|
|
8
8
|
describe('Websocket IConnection Requests', () => {
|
|
9
9
|
|
|
@@ -62,8 +62,8 @@ describe('Websocket IConnection Requests', () => {
|
|
|
62
62
|
|
|
63
63
|
await waitForCondition(() => { return (connected1 && connected2) })
|
|
64
64
|
|
|
65
|
-
expect((node1.getTransport() as ConnectionManager).hasConnection(node2.
|
|
66
|
-
expect((node2.getTransport() as ConnectionManager).hasConnection(node1.
|
|
65
|
+
expect((node1.getTransport() as ConnectionManager).hasConnection(node2.getNodeId())).toEqual(true)
|
|
66
|
+
expect((node2.getTransport() as ConnectionManager).hasConnection(node1.getNodeId())).toEqual(true)
|
|
67
67
|
|
|
68
68
|
}, 10000)
|
|
69
69
|
})
|
|
@@ -4,7 +4,7 @@ import { DhtNode } from '../../src/dht/DhtNode'
|
|
|
4
4
|
import { Message, MessageType } from '../../src/proto/packages/dht/protos/DhtRpc'
|
|
5
5
|
import { RpcMessage } from '../../src/proto/packages/proto-rpc/protos/ProtoRpc'
|
|
6
6
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
7
|
-
import { getNodeIdFromPeerDescriptor } from '../../src/
|
|
7
|
+
import { getNodeIdFromPeerDescriptor } from '../../src/identifiers'
|
|
8
8
|
|
|
9
9
|
const MESSAGE_ID = 'mock-message-id'
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ describe('memory leak', () => {
|
|
|
19
19
|
}
|
|
20
20
|
})
|
|
21
21
|
let entryPoint: DhtNode | undefined = new DhtNode({
|
|
22
|
-
|
|
22
|
+
nodeId: getNodeIdFromPeerDescriptor(entryPointDescriptor),
|
|
23
23
|
websocketHost: entryPointDescriptor.websocket!.host,
|
|
24
24
|
websocketPortRange: {
|
|
25
25
|
min: entryPointDescriptor.websocket!.port,
|