@streamr/trackerless-network 100.0.0-testnet-one.4 → 100.0.0-testnet-two.1
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 +7 -7
- package/dist/src/NetworkStack.d.ts +1 -5
- package/dist/src/NetworkStack.js +1 -3
- package/dist/src/NetworkStack.js.map +1 -1
- package/dist/src/logic/DeliveryRpcLocal.d.ts +1 -1
- package/dist/src/logic/DeliveryRpcLocal.js +3 -3
- package/dist/src/logic/DeliveryRpcLocal.js.map +1 -1
- package/dist/src/logic/DeliveryRpcRemote.d.ts +3 -3
- package/dist/src/logic/DeliveryRpcRemote.js +3 -2
- package/dist/src/logic/DeliveryRpcRemote.js.map +1 -1
- package/dist/src/logic/EntryPointDiscovery.d.ts +3 -0
- package/dist/src/logic/EntryPointDiscovery.js +11 -5
- package/dist/src/logic/EntryPointDiscovery.js.map +1 -1
- package/dist/src/logic/RandomGraphNode.d.ts +10 -8
- package/dist/src/logic/RandomGraphNode.js +23 -17
- package/dist/src/logic/RandomGraphNode.js.map +1 -1
- package/dist/src/logic/StreamrNode.js +13 -4
- package/dist/src/logic/StreamrNode.js.map +1 -1
- package/dist/src/logic/formStreamPartDeliveryServiceId.d.ts +2 -1
- package/dist/src/logic/formStreamPartDeliveryServiceId.js.map +1 -1
- package/dist/src/logic/inspect/Inspector.d.ts +5 -11
- package/dist/src/logic/inspect/Inspector.js +2 -3
- package/dist/src/logic/inspect/Inspector.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.d.ts +3 -3
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js +39 -13
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.d.ts +5 -3
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js +18 -8
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/Handshaker.d.ts +1 -6
- package/dist/src/logic/neighbor-discovery/Handshaker.js +6 -6
- package/dist/src/logic/neighbor-discovery/Handshaker.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborFinder.d.ts +1 -6
- package/dist/src/logic/neighbor-discovery/NeighborFinder.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.d.ts +3 -8
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js +1 -3
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.d.ts +2 -2
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js +1 -2
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.d.ts +2 -2
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.js.map +1 -1
- package/dist/src/logic/proxy/ProxyClient.d.ts +4 -1
- package/dist/src/logic/proxy/ProxyClient.js +7 -6
- package/dist/src/logic/proxy/ProxyClient.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js +2 -3
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcRemote.d.ts +2 -2
- package/dist/src/logic/proxy/ProxyConnectionRpcRemote.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js +2 -2
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.d.ts +2 -2
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +21 -22
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +18 -18
- package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +49 -65
- package/dist/src/proto/packages/dht/protos/DhtRpc.js +43 -58
- package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
- package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +11 -12
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.d.ts +6 -5
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.js +2 -2
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.client.js.map +1 -1
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.d.ts +26 -10
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js +21 -9
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js.map +1 -1
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.server.d.ts +4 -3
- package/dist/test/benchmark/first-message.js +4 -6
- package/dist/test/benchmark/first-message.js.map +1 -1
- package/dist/test/utils/utils.d.ts +1 -1
- package/dist/test/utils/utils.js +8 -7
- package/dist/test/utils/utils.js.map +1 -1
- package/package.json +7 -7
- package/protos/NetworkRpc.proto +8 -4
- package/src/NetworkStack.ts +1 -7
- package/src/logic/DeliveryRpcLocal.ts +4 -4
- package/src/logic/DeliveryRpcRemote.ts +5 -4
- package/src/logic/EntryPointDiscovery.ts +10 -6
- package/src/logic/RandomGraphNode.ts +38 -25
- package/src/logic/StreamrNode.ts +22 -5
- package/src/logic/formStreamPartDeliveryServiceId.ts +2 -1
- package/src/logic/inspect/Inspector.ts +15 -16
- package/src/logic/neighbor-discovery/HandshakeRpcLocal.ts +46 -15
- package/src/logic/neighbor-discovery/HandshakeRpcRemote.ts +21 -10
- package/src/logic/neighbor-discovery/Handshaker.ts +15 -24
- package/src/logic/neighbor-discovery/NeighborFinder.ts +1 -7
- package/src/logic/neighbor-discovery/NeighborUpdateManager.ts +10 -12
- package/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts +4 -4
- package/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.ts +2 -2
- package/src/logic/proxy/ProxyClient.ts +19 -7
- package/src/logic/proxy/ProxyConnectionRpcLocal.ts +3 -3
- package/src/logic/proxy/ProxyConnectionRpcRemote.ts +3 -3
- package/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts +3 -2
- package/src/logic/temporary-connection/TemporaryConnectionRpcRemote.ts +2 -2
- package/src/proto/packages/dht/protos/DhtRpc.client.ts +31 -32
- package/src/proto/packages/dht/protos/DhtRpc.server.ts +11 -12
- package/src/proto/packages/dht/protos/DhtRpc.ts +67 -90
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.client.ts +7 -6
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.server.ts +4 -3
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.ts +36 -15
- package/test/benchmark/first-message.ts +8 -6
- package/test/end-to-end/random-graph-with-real-connections.test.ts +10 -5
- package/test/end-to-end/webrtc-full-node-network.test.ts +1 -1
- package/test/end-to-end/websocket-full-node-network.test.ts +2 -2
- package/test/integration/DeliveryRpcRemote.test.ts +3 -3
- package/test/integration/HandshakeRpcRemote.test.ts +2 -4
- package/test/integration/Handshakes.test.ts +8 -7
- package/test/integration/Inspect.test.ts +0 -2
- package/test/integration/NeighborUpdateRpcRemote.test.ts +2 -2
- package/test/integration/NetworkNode.test.ts +0 -2
- package/test/integration/NetworkRpc.test.ts +0 -3
- package/test/integration/RandomGraphNode-Layer1Node-Latencies.test.ts +4 -4
- package/test/integration/RandomGraphNode-Layer1Node.test.ts +4 -5
- package/test/integration/stream-without-default-entrypoints.test.ts +4 -7
- package/test/integration/streamEntryPointReplacing.test.ts +94 -0
- package/test/unit/DeliveryRpcLocal.test.ts +2 -1
- package/test/unit/EntrypointDiscovery.test.ts +5 -2
- package/test/unit/HandshakeRpcLocal.test.ts +47 -9
- package/test/unit/NodeList.test.ts +10 -12
- package/test/unit/ProxyConnectionRpcRemote.test.ts +18 -10
- package/test/unit/RandomGraphNode.test.ts +6 -4
- package/test/utils/mock/MockHandshaker.ts +3 -2
- package/test/utils/mock/MockNeighborFinder.ts +3 -2
- package/test/utils/mock/MockNeighborUpdateManager.ts +3 -2
- package/test/utils/utils.ts +16 -8
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
} from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
14
14
|
import { Empty } from '../../src/proto/google/protobuf/empty'
|
|
15
15
|
import { waitForCondition } from '@streamr/utils'
|
|
16
|
-
import { toProtoRpcClient } from '@streamr/proto-rpc'
|
|
17
16
|
import { createStreamMessage } from '../utils/utils'
|
|
18
17
|
import { StreamPartIDUtils } from '@streamr/protocol'
|
|
19
18
|
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
@@ -73,7 +72,8 @@ describe('DeliveryRpcRemote', () => {
|
|
|
73
72
|
clientNode,
|
|
74
73
|
serverNode,
|
|
75
74
|
STREAM_PART_ID,
|
|
76
|
-
|
|
75
|
+
clientRpc,
|
|
76
|
+
DeliveryRpcClient
|
|
77
77
|
)
|
|
78
78
|
})
|
|
79
79
|
|
|
@@ -97,7 +97,7 @@ describe('DeliveryRpcRemote', () => {
|
|
|
97
97
|
})
|
|
98
98
|
|
|
99
99
|
it('leaveNotice', async () => {
|
|
100
|
-
rpcRemote.leaveStreamPartNotice()
|
|
100
|
+
rpcRemote.leaveStreamPartNotice(false)
|
|
101
101
|
await waitForCondition(() => recvCounter === 1)
|
|
102
102
|
})
|
|
103
103
|
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
Simulator,
|
|
10
10
|
SimulatorTransport
|
|
11
11
|
} from '@streamr/dht'
|
|
12
|
-
import { toProtoRpcClient } from '@streamr/proto-rpc'
|
|
13
12
|
import {
|
|
14
13
|
HandshakeRpcClient,
|
|
15
14
|
} from '../../src/proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
@@ -34,7 +33,6 @@ describe('HandshakeRpcRemote', () => {
|
|
|
34
33
|
let mockConnectionManager2: SimulatorTransport
|
|
35
34
|
|
|
36
35
|
beforeEach(async () => {
|
|
37
|
-
Simulator.useFakeTimers()
|
|
38
36
|
simulator = new Simulator()
|
|
39
37
|
mockConnectionManager1 = new SimulatorTransport(serverNode, simulator)
|
|
40
38
|
await mockConnectionManager1.start()
|
|
@@ -61,7 +59,8 @@ describe('HandshakeRpcRemote', () => {
|
|
|
61
59
|
clientNode,
|
|
62
60
|
serverNode,
|
|
63
61
|
'test-stream-part',
|
|
64
|
-
|
|
62
|
+
clientRpc,
|
|
63
|
+
HandshakeRpcClient
|
|
65
64
|
)
|
|
66
65
|
})
|
|
67
66
|
|
|
@@ -71,7 +70,6 @@ describe('HandshakeRpcRemote', () => {
|
|
|
71
70
|
await mockConnectionManager1.stop()
|
|
72
71
|
await mockConnectionManager2.stop()
|
|
73
72
|
simulator.stop()
|
|
74
|
-
Simulator.useFakeTimers(false)
|
|
75
73
|
})
|
|
76
74
|
|
|
77
75
|
it('handshake', async () => {
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
Simulator,
|
|
7
7
|
SimulatorTransport
|
|
8
8
|
} from '@streamr/dht'
|
|
9
|
-
import { toProtoRpcClient } from '@streamr/proto-rpc'
|
|
10
9
|
import {
|
|
11
10
|
HandshakeRpcClient
|
|
12
11
|
} from '../../src/proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
@@ -70,7 +69,6 @@ describe('Handshakes', () => {
|
|
|
70
69
|
let simulatorTransport3: SimulatorTransport
|
|
71
70
|
|
|
72
71
|
beforeEach(async () => {
|
|
73
|
-
Simulator.useFakeTimers()
|
|
74
72
|
simulator = new Simulator()
|
|
75
73
|
simulatorTransport1 = new SimulatorTransport(peerDescriptor1, simulator)
|
|
76
74
|
await simulatorTransport1.start()
|
|
@@ -107,7 +105,6 @@ describe('Handshakes', () => {
|
|
|
107
105
|
await simulatorTransport2.stop()
|
|
108
106
|
await simulatorTransport3.stop()
|
|
109
107
|
simulator.stop()
|
|
110
|
-
Simulator.useFakeTimers(false)
|
|
111
108
|
})
|
|
112
109
|
|
|
113
110
|
it('Two nodes can handshake', async () => {
|
|
@@ -118,7 +115,8 @@ describe('Handshakes', () => {
|
|
|
118
115
|
peerDescriptor2,
|
|
119
116
|
peerDescriptor1,
|
|
120
117
|
streamPartId,
|
|
121
|
-
|
|
118
|
+
rpcCommunicator2,
|
|
119
|
+
HandshakeRpcClient
|
|
122
120
|
)
|
|
123
121
|
)
|
|
124
122
|
expect(res).toEqual(true)
|
|
@@ -133,7 +131,8 @@ describe('Handshakes', () => {
|
|
|
133
131
|
peerDescriptor2,
|
|
134
132
|
peerDescriptor1,
|
|
135
133
|
streamPartId,
|
|
136
|
-
|
|
134
|
+
rpcCommunicator2,
|
|
135
|
+
HandshakeRpcClient
|
|
137
136
|
)
|
|
138
137
|
)
|
|
139
138
|
expect(res).toEqual(true)
|
|
@@ -148,7 +147,8 @@ describe('Handshakes', () => {
|
|
|
148
147
|
peerDescriptor2,
|
|
149
148
|
peerDescriptor1,
|
|
150
149
|
streamPartId,
|
|
151
|
-
|
|
150
|
+
rpcCommunicator2,
|
|
151
|
+
HandshakeRpcClient
|
|
152
152
|
)
|
|
153
153
|
)
|
|
154
154
|
expect(res).toEqual(false)
|
|
@@ -164,7 +164,8 @@ describe('Handshakes', () => {
|
|
|
164
164
|
peerDescriptor2,
|
|
165
165
|
peerDescriptor1,
|
|
166
166
|
streamPartId,
|
|
167
|
-
|
|
167
|
+
rpcCommunicator2,
|
|
168
|
+
HandshakeRpcClient
|
|
168
169
|
)
|
|
169
170
|
)
|
|
170
171
|
expect(res).toEqual(true)
|
|
@@ -38,7 +38,6 @@ describe('inspect', () => {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
beforeEach(async () => {
|
|
41
|
-
Simulator.useFakeTimers()
|
|
42
41
|
simulator = new Simulator(LatencyType.REAL)
|
|
43
42
|
|
|
44
43
|
publisherNode = await initiateNode(publisherDescriptor, simulator)
|
|
@@ -65,7 +64,6 @@ describe('inspect', () => {
|
|
|
65
64
|
inspectorNode.stop(),
|
|
66
65
|
...inspectedNodes.map((node) => node.stop())
|
|
67
66
|
])
|
|
68
|
-
Simulator.useFakeTimers(false)
|
|
69
67
|
})
|
|
70
68
|
|
|
71
69
|
it('gets successful inspections from all suspects', async () => {
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
Simulator,
|
|
6
6
|
SimulatorTransport
|
|
7
7
|
} from '@streamr/dht'
|
|
8
|
-
import { toProtoRpcClient } from '@streamr/proto-rpc'
|
|
9
8
|
import { NeighborUpdateRpcRemote } from '../../src/logic/neighbor-discovery/NeighborUpdateRpcRemote'
|
|
10
9
|
import { NeighborUpdate } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
11
10
|
import {
|
|
@@ -64,7 +63,8 @@ describe('NeighborUpdateRpcRemote', () => {
|
|
|
64
63
|
clientNode,
|
|
65
64
|
serverNode,
|
|
66
65
|
'test-stream-part',
|
|
67
|
-
|
|
66
|
+
clientRpc,
|
|
67
|
+
NeighborUpdateRpcClient
|
|
68
68
|
)
|
|
69
69
|
})
|
|
70
70
|
|
|
@@ -30,7 +30,6 @@ describe('NetworkNode', () => {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
beforeEach(async () => {
|
|
33
|
-
Simulator.useFakeTimers()
|
|
34
33
|
const simulator = new Simulator()
|
|
35
34
|
transport1 = new SimulatorTransport(pd1, simulator)
|
|
36
35
|
await transport1.start()
|
|
@@ -63,7 +62,6 @@ describe('NetworkNode', () => {
|
|
|
63
62
|
node1.stop(),
|
|
64
63
|
node2.stop()
|
|
65
64
|
])
|
|
66
|
-
Simulator.useFakeTimers(false)
|
|
67
65
|
})
|
|
68
66
|
|
|
69
67
|
it('wait for join + broadcast and subscribe', async () => {
|
|
@@ -9,7 +9,6 @@ import { waitForCondition } from '@streamr/utils'
|
|
|
9
9
|
import { Empty } from '../../src/proto/google/protobuf/empty'
|
|
10
10
|
import { createStreamMessage } from '../utils/utils'
|
|
11
11
|
import { RpcMessage } from '../../src/proto/packages/proto-rpc/protos/ProtoRpc'
|
|
12
|
-
import { Simulator } from '@streamr/dht'
|
|
13
12
|
import { StreamPartIDUtils } from '@streamr/protocol'
|
|
14
13
|
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
15
14
|
|
|
@@ -20,7 +19,6 @@ describe('Network RPC', () => {
|
|
|
20
19
|
let recvCounter = 0
|
|
21
20
|
|
|
22
21
|
beforeEach(() => {
|
|
23
|
-
Simulator.useFakeTimers()
|
|
24
22
|
rpcCommunicator1 = new RpcCommunicator()
|
|
25
23
|
rpcCommunicator2 = new RpcCommunicator()
|
|
26
24
|
rpcCommunicator1.on('outgoingMessage', (message: RpcMessage) => {
|
|
@@ -40,7 +38,6 @@ describe('Network RPC', () => {
|
|
|
40
38
|
afterEach(() => {
|
|
41
39
|
rpcCommunicator1.stop()
|
|
42
40
|
rpcCommunicator2.stop()
|
|
43
|
-
Simulator.useFakeTimers(false)
|
|
44
41
|
})
|
|
45
42
|
|
|
46
43
|
it('sends Data', async () => {
|
|
@@ -19,7 +19,6 @@ describe('RandomGraphNode-DhtNode-Latencies', () => {
|
|
|
19
19
|
|
|
20
20
|
const peerDescriptors: PeerDescriptor[] = range(numOfNodes).map(() => createMockPeerDescriptor())
|
|
21
21
|
beforeEach(async () => {
|
|
22
|
-
Simulator.useFakeTimers()
|
|
23
22
|
const simulator = new Simulator(LatencyType.FIXED, 50)
|
|
24
23
|
const entrypointCm = new SimulatorTransport(entrypointDescriptor, simulator)
|
|
25
24
|
const cms: SimulatorTransport[] = range(numOfNodes).map((i) =>
|
|
@@ -43,14 +42,16 @@ describe('RandomGraphNode-DhtNode-Latencies', () => {
|
|
|
43
42
|
layer1Node: layer1Nodes[i],
|
|
44
43
|
transport: cms[i],
|
|
45
44
|
connectionLocker: cms[i],
|
|
46
|
-
localPeerDescriptor: peerDescriptors[i]
|
|
45
|
+
localPeerDescriptor: peerDescriptors[i],
|
|
46
|
+
isLocalNodeEntryPoint: () => false
|
|
47
47
|
}))
|
|
48
48
|
entryPointRandomGraphNode = createRandomGraphNode({
|
|
49
49
|
streamPartId,
|
|
50
50
|
layer1Node: dhtEntryPoint,
|
|
51
51
|
transport: entrypointCm,
|
|
52
52
|
connectionLocker: entrypointCm,
|
|
53
|
-
localPeerDescriptor: entrypointDescriptor
|
|
53
|
+
localPeerDescriptor: entrypointDescriptor,
|
|
54
|
+
isLocalNodeEntryPoint: () => false
|
|
54
55
|
})
|
|
55
56
|
|
|
56
57
|
await dhtEntryPoint.start()
|
|
@@ -63,7 +64,6 @@ describe('RandomGraphNode-DhtNode-Latencies', () => {
|
|
|
63
64
|
entryPointRandomGraphNode.stop()
|
|
64
65
|
await Promise.all(layer1Nodes.map((node) => node.stop()))
|
|
65
66
|
await Promise.all(graphNodes.map((node) => node.stop()))
|
|
66
|
-
Simulator.useFakeTimers(false)
|
|
67
67
|
})
|
|
68
68
|
|
|
69
69
|
it('happy path single node', async () => {
|
|
@@ -27,8 +27,6 @@ describe('RandomGraphNode-DhtNode', () => {
|
|
|
27
27
|
})
|
|
28
28
|
})
|
|
29
29
|
beforeEach(async () => {
|
|
30
|
-
|
|
31
|
-
Simulator.useFakeTimers()
|
|
32
30
|
const simulator = new Simulator()
|
|
33
31
|
const entrypointCm = new SimulatorTransport(
|
|
34
32
|
entrypointDescriptor,
|
|
@@ -62,7 +60,8 @@ describe('RandomGraphNode-DhtNode', () => {
|
|
|
62
60
|
transport: cms[i],
|
|
63
61
|
connectionLocker: cms[i],
|
|
64
62
|
localPeerDescriptor: peerDescriptors[i],
|
|
65
|
-
neighborUpdateInterval: 2000
|
|
63
|
+
neighborUpdateInterval: 2000,
|
|
64
|
+
isLocalNodeEntryPoint: () => false
|
|
66
65
|
}))
|
|
67
66
|
|
|
68
67
|
entryPointRandomGraphNode = createRandomGraphNode({
|
|
@@ -71,7 +70,8 @@ describe('RandomGraphNode-DhtNode', () => {
|
|
|
71
70
|
transport: entrypointCm,
|
|
72
71
|
connectionLocker: entrypointCm,
|
|
73
72
|
localPeerDescriptor: entrypointDescriptor,
|
|
74
|
-
neighborUpdateInterval: 2000
|
|
73
|
+
neighborUpdateInterval: 2000,
|
|
74
|
+
isLocalNodeEntryPoint: () => false
|
|
75
75
|
})
|
|
76
76
|
|
|
77
77
|
await dhtEntryPoint.start()
|
|
@@ -84,7 +84,6 @@ describe('RandomGraphNode-DhtNode', () => {
|
|
|
84
84
|
entryPointRandomGraphNode.stop()
|
|
85
85
|
await Promise.all(layer1Nodes.map((node) => node.stop()))
|
|
86
86
|
await Promise.all(graphNodes.map((node) => node.stop()))
|
|
87
|
-
Simulator.useFakeTimers(false)
|
|
88
87
|
})
|
|
89
88
|
|
|
90
89
|
it('happy path single node ', async () => {
|
|
@@ -43,7 +43,6 @@ describe('stream without default entrypoints', () => {
|
|
|
43
43
|
})
|
|
44
44
|
|
|
45
45
|
beforeEach(async () => {
|
|
46
|
-
Simulator.useFakeTimers()
|
|
47
46
|
const simulator = new Simulator(LatencyType.REAL)
|
|
48
47
|
nodes = []
|
|
49
48
|
numOfReceivedMessages = 0
|
|
@@ -76,7 +75,6 @@ describe('stream without default entrypoints', () => {
|
|
|
76
75
|
afterEach(async () => {
|
|
77
76
|
await entrypoint.stop()
|
|
78
77
|
await Promise.all(nodes.map((node) => node.stop()))
|
|
79
|
-
Simulator.useFakeTimers(false)
|
|
80
78
|
})
|
|
81
79
|
|
|
82
80
|
it('can join stream without configured entrypoints one by one', async () => {
|
|
@@ -105,14 +103,13 @@ describe('stream without default entrypoints', () => {
|
|
|
105
103
|
const numOfSubscribers = 8
|
|
106
104
|
await Promise.all(range(numOfSubscribers).map(async (i) => {
|
|
107
105
|
await nodes[i].join(STREAM_PART_ID, { minCount: 4, timeout: 15000 })
|
|
108
|
-
nodes[i].addMessageListener((
|
|
106
|
+
nodes[i].addMessageListener(() => {
|
|
109
107
|
numOfReceivedMessages += 1
|
|
110
108
|
})
|
|
111
109
|
}))
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
])
|
|
110
|
+
const nonjoinedNode = nodes[numOfSubscribers]
|
|
111
|
+
await nonjoinedNode.broadcast(streamMessage)
|
|
112
|
+
await waitForCondition(() => numOfReceivedMessages === numOfSubscribers, 15000)
|
|
116
113
|
}, 45000)
|
|
117
114
|
|
|
118
115
|
it('nodes store themselves as entrypoints on streamPart if number of entrypoints is low', async () => {
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Simulator, SimulatorTransport, LatencyType } from '@streamr/dht'
|
|
2
|
+
import { NetworkStack } from '../../src/NetworkStack'
|
|
3
|
+
import { createMockPeerDescriptor, createStreamMessage } from '../utils/utils'
|
|
4
|
+
import { ENTRYPOINT_STORE_LIMIT } from '../../src/logic/EntryPointDiscovery'
|
|
5
|
+
import { range } from 'lodash'
|
|
6
|
+
import { StreamPartIDUtils } from '@streamr/protocol'
|
|
7
|
+
import { waitForCondition } from '@streamr/utils'
|
|
8
|
+
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
9
|
+
|
|
10
|
+
describe('Stream Entry Points are replaced when known entry points leave streams', () => {
|
|
11
|
+
|
|
12
|
+
let simulator: Simulator
|
|
13
|
+
let layer0EntryPoint: NetworkStack
|
|
14
|
+
const entryPointPeerDescriptor = createMockPeerDescriptor()
|
|
15
|
+
let initialNodesOnStream: NetworkStack[]
|
|
16
|
+
let laterNodesOnStream: NetworkStack[]
|
|
17
|
+
let newNodeInStream: NetworkStack
|
|
18
|
+
|
|
19
|
+
const NUM_OF_LATER_NODES = 16
|
|
20
|
+
|
|
21
|
+
const STREAM_PART_ID = StreamPartIDUtils.parse('stream#0')
|
|
22
|
+
|
|
23
|
+
const startNode = async () => {
|
|
24
|
+
const peerDescriptor = createMockPeerDescriptor()
|
|
25
|
+
const transport = new SimulatorTransport(peerDescriptor, simulator)
|
|
26
|
+
await transport.start()
|
|
27
|
+
const node = new NetworkStack({
|
|
28
|
+
layer0: {
|
|
29
|
+
transport,
|
|
30
|
+
peerDescriptor,
|
|
31
|
+
entryPoints: [entryPointPeerDescriptor]
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
await node.start()
|
|
35
|
+
return node
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
beforeEach(async () => {
|
|
39
|
+
simulator = new Simulator(LatencyType.REAL)
|
|
40
|
+
const entryPointTransport = new SimulatorTransport(entryPointPeerDescriptor, simulator)
|
|
41
|
+
layer0EntryPoint = new NetworkStack({
|
|
42
|
+
layer0: {
|
|
43
|
+
transport: entryPointTransport,
|
|
44
|
+
peerDescriptor: entryPointPeerDescriptor,
|
|
45
|
+
entryPoints: [entryPointPeerDescriptor]
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
await entryPointTransport.start()
|
|
49
|
+
await layer0EntryPoint.start()
|
|
50
|
+
|
|
51
|
+
initialNodesOnStream = await Promise.all(range(ENTRYPOINT_STORE_LIMIT).map(async () => {
|
|
52
|
+
return await startNode()
|
|
53
|
+
}))
|
|
54
|
+
|
|
55
|
+
laterNodesOnStream = await Promise.all(range(NUM_OF_LATER_NODES).map(async () => {
|
|
56
|
+
return await startNode()
|
|
57
|
+
}))
|
|
58
|
+
newNodeInStream = await startNode()
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
afterEach(async () => {
|
|
62
|
+
await Promise.all([
|
|
63
|
+
layer0EntryPoint.stop(),
|
|
64
|
+
...initialNodesOnStream.map((node) => node.stop()),
|
|
65
|
+
...laterNodesOnStream.map((node) => node.stop()),
|
|
66
|
+
newNodeInStream.stop()
|
|
67
|
+
])
|
|
68
|
+
simulator.stop()
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('stream entry points are replaced when nodes leave streams', async () => {
|
|
72
|
+
// TODO: Investigate why CI needs more than 15 seconds to find 4 neighbors for the stream.
|
|
73
|
+
await Promise.all(initialNodesOnStream.map((node) => node.joinStreamPart(STREAM_PART_ID, { minCount: 4, timeout: 30000 })))
|
|
74
|
+
|
|
75
|
+
let receivedMessages = 0
|
|
76
|
+
for (const node of laterNodesOnStream) {
|
|
77
|
+
await node.joinStreamPart(STREAM_PART_ID, { minCount: 4, timeout: 30000 })
|
|
78
|
+
node.getStreamrNode().on('newMessage', () => {
|
|
79
|
+
receivedMessages += 1
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
await Promise.all(initialNodesOnStream.map((node) => node.getStreamrNode().leaveStreamPart(STREAM_PART_ID)))
|
|
84
|
+
await waitForCondition(() => laterNodesOnStream.every((node) => node.getStreamrNode().getNeighbors(STREAM_PART_ID).length >= 4), 30000, 1000)
|
|
85
|
+
|
|
86
|
+
const msg = createStreamMessage(
|
|
87
|
+
JSON.stringify({ hello: 'WORLD' }),
|
|
88
|
+
STREAM_PART_ID,
|
|
89
|
+
randomEthereumAddress()
|
|
90
|
+
)
|
|
91
|
+
newNodeInStream.getStreamrNode().broadcast(msg)
|
|
92
|
+
await waitForCondition(() => receivedMessages === NUM_OF_LATER_NODES, 15000)
|
|
93
|
+
}, 200000)
|
|
94
|
+
})
|
|
@@ -50,7 +50,8 @@ describe('DeliveryRpcLocal', () => {
|
|
|
50
50
|
|
|
51
51
|
it('Server leaveStreamPartNotice()', async () => {
|
|
52
52
|
const leaveNotice: LeaveStreamPartNotice = {
|
|
53
|
-
streamPartId: StreamPartIDUtils.parse('stream#0')
|
|
53
|
+
streamPartId: StreamPartIDUtils.parse('stream#0'),
|
|
54
|
+
isEntryPoint: false
|
|
54
55
|
}
|
|
55
56
|
await rpcLocal.leaveStreamPartNotice(leaveNotice, { incomingSourceDescriptor: mockSender } as any)
|
|
56
57
|
expect(mockOnLeaveNotice).toHaveBeenCalledTimes(1)
|
|
@@ -22,7 +22,7 @@ describe('EntryPointDiscovery', () => {
|
|
|
22
22
|
const fakeData: DataEntry = {
|
|
23
23
|
key: Uint8Array.from([1, 2, 3]),
|
|
24
24
|
data: Any.pack(peerDescriptor, PeerDescriptor),
|
|
25
|
-
creator: peerDescriptor,
|
|
25
|
+
creator: peerDescriptor.nodeId,
|
|
26
26
|
ttl: 1000,
|
|
27
27
|
stale: false,
|
|
28
28
|
deleted: false
|
|
@@ -31,7 +31,7 @@ describe('EntryPointDiscovery', () => {
|
|
|
31
31
|
const fakeDeletedData: DataEntry = {
|
|
32
32
|
key: Uint8Array.from([1, 2, 3]),
|
|
33
33
|
data: Any.pack(deletedPeerDescriptor, PeerDescriptor),
|
|
34
|
-
creator: deletedPeerDescriptor,
|
|
34
|
+
creator: deletedPeerDescriptor.nodeId,
|
|
35
35
|
ttl: 1000,
|
|
36
36
|
stale: false,
|
|
37
37
|
deleted: true
|
|
@@ -112,17 +112,20 @@ describe('EntryPointDiscovery', () => {
|
|
|
112
112
|
it('store on empty stream', async () => {
|
|
113
113
|
await entryPointDiscoveryWithData.storeSelfAsEntryPointIfNecessary(0)
|
|
114
114
|
expect(storeCalled).toEqual(1)
|
|
115
|
+
expect(entryPointDiscoveryWithData.isLocalNodeEntryPoint()).toEqual(true)
|
|
115
116
|
})
|
|
116
117
|
|
|
117
118
|
it('store on stream without saturated entrypoint count', async () => {
|
|
118
119
|
addNodesToStreamPart(layer1Node, 4)
|
|
119
120
|
await entryPointDiscoveryWithData.storeSelfAsEntryPointIfNecessary(0)
|
|
120
121
|
expect(storeCalled).toEqual(1)
|
|
122
|
+
expect(entryPointDiscoveryWithData.isLocalNodeEntryPoint()).toEqual(true)
|
|
121
123
|
})
|
|
122
124
|
|
|
123
125
|
it('will keep stored until destroyed', async () => {
|
|
124
126
|
await entryPointDiscoveryWithData.storeSelfAsEntryPointIfNecessary(0)
|
|
125
127
|
expect(storeCalled).toEqual(1)
|
|
128
|
+
expect(entryPointDiscoveryWithData.isLocalNodeEntryPoint()).toEqual(true)
|
|
126
129
|
await wait(4500)
|
|
127
130
|
await entryPointDiscoveryWithData.destroy()
|
|
128
131
|
// we have configured storeInterval to 2 seconds, i.e. after 4.5 seconds it should have been called 2 more items
|
|
@@ -3,7 +3,7 @@ import { hexToBinary } from '@streamr/utils'
|
|
|
3
3
|
import { NodeID, getNodeIdFromPeerDescriptor } from '../../src/identifiers'
|
|
4
4
|
import { NodeList } from '../../src/logic/NodeList'
|
|
5
5
|
import { HandshakeRpcLocal } from '../../src/logic/neighbor-discovery/HandshakeRpcLocal'
|
|
6
|
-
import {
|
|
6
|
+
import { InterleaveRequest, StreamPartHandshakeRequest } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
7
7
|
import { createMockPeerDescriptor, createMockHandshakeRpcRemote, createMockDeliveryRpcRemote, mockConnectionLocker } from '../utils/utils'
|
|
8
8
|
import { StreamPartIDUtils } from '@streamr/protocol'
|
|
9
9
|
|
|
@@ -17,18 +17,20 @@ describe('HandshakeRpcLocal', () => {
|
|
|
17
17
|
|
|
18
18
|
let targetNeighbors: NodeList
|
|
19
19
|
let ongoingHandshakes: Set<NodeID>
|
|
20
|
+
let ongoingInterleaves: Set<NodeID>
|
|
20
21
|
let handshakeWithInterleaving: jest.Mock
|
|
21
22
|
|
|
22
23
|
beforeEach(() => {
|
|
23
24
|
targetNeighbors = new NodeList(getNodeIdFromPeerDescriptor(localPeerDescriptor), 10)
|
|
24
25
|
ongoingHandshakes = new Set()
|
|
25
|
-
|
|
26
|
+
ongoingInterleaves = new Set()
|
|
26
27
|
handshakeWithInterleaving = jest.fn()
|
|
27
28
|
|
|
28
29
|
rpcLocal = new HandshakeRpcLocal({
|
|
29
30
|
streamPartId: STREAM_PART_ID,
|
|
30
31
|
connectionLocker: mockConnectionLocker,
|
|
31
32
|
ongoingHandshakes,
|
|
33
|
+
ongoingInterleaves,
|
|
32
34
|
createRpcRemote: (_p) => createMockHandshakeRpcRemote(),
|
|
33
35
|
createDeliveryRpcRemote: (_p) => createMockDeliveryRpcRemote(),
|
|
34
36
|
handshakeWithInterleaving: async (_p, _t) => {
|
|
@@ -85,31 +87,67 @@ describe('HandshakeRpcLocal', () => {
|
|
|
85
87
|
})
|
|
86
88
|
|
|
87
89
|
it('handshakeWithInterleaving success', async () => {
|
|
88
|
-
const req:
|
|
89
|
-
streamPartId: STREAM_PART_ID,
|
|
90
|
+
const req: InterleaveRequest = {
|
|
90
91
|
interleaveTargetDescriptor: {
|
|
91
92
|
nodeId: hexToBinary('0x2222'),
|
|
92
93
|
type: NodeType.NODEJS
|
|
93
94
|
}
|
|
94
|
-
|
|
95
95
|
}
|
|
96
|
-
await rpcLocal.
|
|
96
|
+
await rpcLocal.interleaveRequest(req, {
|
|
97
97
|
incomingSourceDescriptor: createMockPeerDescriptor()
|
|
98
98
|
} as any)
|
|
99
99
|
expect(handshakeWithInterleaving).toHaveBeenCalledTimes(1)
|
|
100
100
|
})
|
|
101
101
|
|
|
102
102
|
it('handshakeWithInterleaving success', async () => {
|
|
103
|
-
const req:
|
|
104
|
-
streamPartId: StreamPartIDUtils.parse('other-stream#0'),
|
|
103
|
+
const req: InterleaveRequest = {
|
|
105
104
|
interleaveTargetDescriptor: {
|
|
106
105
|
nodeId: hexToBinary('0x2222'),
|
|
107
106
|
type: NodeType.NODEJS
|
|
108
107
|
}
|
|
109
108
|
}
|
|
110
|
-
await rpcLocal.
|
|
109
|
+
await rpcLocal.interleaveRequest(req, {
|
|
110
|
+
incomingSourceDescriptor: createMockPeerDescriptor()
|
|
111
|
+
} as any)
|
|
112
|
+
expect(handshakeWithInterleaving).toHaveBeenCalledTimes(1)
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
it('rejects handshakes if interleaving to the requestor is ongoing', async () => {
|
|
116
|
+
targetNeighbors.add(createMockDeliveryRpcRemote())
|
|
117
|
+
targetNeighbors.add(createMockDeliveryRpcRemote())
|
|
118
|
+
targetNeighbors.add(createMockDeliveryRpcRemote())
|
|
119
|
+
targetNeighbors.add(createMockDeliveryRpcRemote())
|
|
120
|
+
const requestor = createMockPeerDescriptor()
|
|
121
|
+
ongoingInterleaves.add(getNodeIdFromPeerDescriptor(requestor))
|
|
122
|
+
const req = StreamPartHandshakeRequest.create({
|
|
123
|
+
streamPartId: STREAM_PART_ID,
|
|
124
|
+
requestId: 'requestId'
|
|
125
|
+
})
|
|
126
|
+
const res = await rpcLocal.handshake(req, {
|
|
127
|
+
incomingSourceDescriptor: requestor
|
|
128
|
+
} as any)
|
|
129
|
+
expect(res.accepted).toEqual(false)
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
it('Rejects if interleaving is required and too many interleaving requests are ongoing', async () => {
|
|
133
|
+
const interleavingPeer1 = createMockPeerDescriptor()
|
|
134
|
+
const interleavingPeer2 = createMockPeerDescriptor()
|
|
135
|
+
const interleavingPeer3 = createMockPeerDescriptor()
|
|
136
|
+
targetNeighbors.add(createMockDeliveryRpcRemote(interleavingPeer1))
|
|
137
|
+
targetNeighbors.add(createMockDeliveryRpcRemote(interleavingPeer2))
|
|
138
|
+
targetNeighbors.add(createMockDeliveryRpcRemote(interleavingPeer3))
|
|
139
|
+
targetNeighbors.add(createMockDeliveryRpcRemote())
|
|
140
|
+
ongoingInterleaves.add(getNodeIdFromPeerDescriptor(interleavingPeer1))
|
|
141
|
+
ongoingInterleaves.add(getNodeIdFromPeerDescriptor(interleavingPeer2))
|
|
142
|
+
ongoingInterleaves.add(getNodeIdFromPeerDescriptor(interleavingPeer3))
|
|
143
|
+
const req = StreamPartHandshakeRequest.create({
|
|
144
|
+
streamPartId: STREAM_PART_ID,
|
|
145
|
+
requestId: 'requestId'
|
|
146
|
+
})
|
|
147
|
+
const res = await rpcLocal.handshake(req, {
|
|
111
148
|
incomingSourceDescriptor: createMockPeerDescriptor()
|
|
112
149
|
} as any)
|
|
150
|
+
expect(res.accepted).toEqual(false)
|
|
113
151
|
expect(handshakeWithInterleaving).toHaveBeenCalledTimes(0)
|
|
114
152
|
})
|
|
115
153
|
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { NodeList } from '../../src/logic/NodeList'
|
|
2
|
-
import { DeliveryRpcRemote } from '../../src/logic/DeliveryRpcRemote'
|
|
3
1
|
import {
|
|
4
|
-
PeerDescriptor,
|
|
5
2
|
ListeningRpcCommunicator,
|
|
3
|
+
NodeType,
|
|
4
|
+
PeerDescriptor,
|
|
6
5
|
Simulator,
|
|
7
6
|
SimulatorTransport,
|
|
8
|
-
NodeType,
|
|
9
7
|
} from '@streamr/dht'
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { StreamPartIDUtils } from '@streamr/protocol'
|
|
9
|
+
import { binaryToHex } from '@streamr/utils'
|
|
12
10
|
import { expect } from 'expect'
|
|
13
11
|
import { NodeID, getNodeIdFromPeerDescriptor } from '../../src/identifiers'
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { StreamPartIDUtils } from '@streamr/protocol'
|
|
12
|
+
import { DeliveryRpcRemote } from '../../src/logic/DeliveryRpcRemote'
|
|
13
|
+
import { NodeList } from '../../src/logic/NodeList'
|
|
17
14
|
import { formStreamPartDeliveryServiceId } from '../../src/logic/formStreamPartDeliveryServiceId'
|
|
15
|
+
import { DeliveryRpcClient } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
16
|
+
import { createMockPeerDescriptor, createRandomNodeId } from '../utils/utils'
|
|
18
17
|
|
|
19
18
|
const streamPartId = StreamPartIDUtils.parse('stream#0')
|
|
20
19
|
|
|
@@ -36,14 +35,13 @@ describe('NodeList', () => {
|
|
|
36
35
|
const mockTransport = new SimulatorTransport(peerDescriptor, simulator)
|
|
37
36
|
await mockTransport.start()
|
|
38
37
|
const mockCommunicator = new ListeningRpcCommunicator(formStreamPartDeliveryServiceId(streamPartId), mockTransport)
|
|
39
|
-
const mockClient = mockCommunicator.getRpcClientTransport()
|
|
40
|
-
|
|
41
38
|
mockTransports.push(mockTransport)
|
|
42
39
|
return new DeliveryRpcRemote(
|
|
43
40
|
createMockPeerDescriptor(),
|
|
44
41
|
peerDescriptor,
|
|
45
42
|
streamPartId,
|
|
46
|
-
|
|
43
|
+
mockCommunicator,
|
|
44
|
+
DeliveryRpcClient
|
|
47
45
|
)
|
|
48
46
|
}
|
|
49
47
|
|
|
@@ -1,30 +1,38 @@
|
|
|
1
|
+
import { RpcCommunicator } from '@streamr/proto-rpc'
|
|
1
2
|
import { StreamPartIDUtils } from '@streamr/protocol'
|
|
2
3
|
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
3
4
|
import { hexToBinary } from '@streamr/utils'
|
|
4
5
|
import { ProxyConnectionRpcRemote } from '../../src/logic/proxy/ProxyConnectionRpcRemote'
|
|
5
|
-
import { ProxyDirection } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
6
|
+
import { ProxyConnectionRequest, ProxyDirection } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
7
|
+
import { ProxyConnectionRpcClient } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
6
8
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
7
9
|
|
|
8
10
|
describe('ProxyConnectionRpcRemote', () => {
|
|
9
11
|
|
|
10
|
-
it('happy path', () => {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
it('happy path', async () => {
|
|
13
|
+
const onOutgoingMessage = jest.fn()
|
|
14
|
+
const rpcCommunicator = new RpcCommunicator()
|
|
15
|
+
rpcCommunicator.setOutgoingMessageListener(onOutgoingMessage)
|
|
14
16
|
const clientPeerDescriptor = createMockPeerDescriptor()
|
|
15
17
|
const serverPeerDescriptor = createMockPeerDescriptor()
|
|
16
18
|
const rpcRemote = new ProxyConnectionRpcRemote(
|
|
17
19
|
clientPeerDescriptor,
|
|
18
20
|
serverPeerDescriptor,
|
|
19
21
|
StreamPartIDUtils.parse('stream#0'),
|
|
20
|
-
|
|
22
|
+
rpcCommunicator,
|
|
23
|
+
ProxyConnectionRpcClient
|
|
21
24
|
)
|
|
25
|
+
|
|
22
26
|
const userId = randomEthereumAddress()
|
|
23
|
-
rpcRemote.requestConnection(ProxyDirection.PUBLISH, userId)
|
|
24
|
-
|
|
27
|
+
await rpcRemote.requestConnection(ProxyDirection.PUBLISH, userId)
|
|
28
|
+
|
|
29
|
+
const [rpcMessage, _, callContext] = onOutgoingMessage.mock.calls[0]
|
|
30
|
+
const request = ProxyConnectionRequest.fromBinary(rpcMessage.body.value)
|
|
31
|
+
expect(request).toEqual({
|
|
25
32
|
direction: ProxyDirection.PUBLISH,
|
|
26
|
-
userId: hexToBinary(userId)
|
|
27
|
-
}
|
|
33
|
+
userId: Uint8Array.from(hexToBinary(userId))
|
|
34
|
+
})
|
|
35
|
+
expect(callContext).toMatchObject({
|
|
28
36
|
sourceDescriptor: clientPeerDescriptor,
|
|
29
37
|
targetDescriptor: serverPeerDescriptor,
|
|
30
38
|
timeout: 5000
|