From 0949c1dfb54126822900d80bf6bfab798ee45b17 Mon Sep 17 00:00:00 2001 From: Fabio Barone Date: Fri, 22 Mar 2019 18:15:44 -0500 Subject: [PATCH] swarm/network: lock use of hive.depth --- swarm/network/discovery_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/swarm/network/discovery_test.go b/swarm/network/discovery_test.go index 272c1ec3e5..c36f149d12 100644 --- a/swarm/network/discovery_test.go +++ b/swarm/network/discovery_test.go @@ -162,6 +162,10 @@ func testSubpeersMsg(t *testing.T) { controlDepth = 2 } + hive.lock.Lock() + hiveDepth := hive.depth + hive.lock.Unlock() + // the test exchange is as follows: // 1. Wait for a `subPeersMsg` advertizing the hive's depth from our hive to our control node // 2. Trigger a `suPeersMsg` from the control node advertizing its own depth @@ -171,7 +175,7 @@ func testSubpeersMsg(t *testing.T) { Expects: []p2ptest.Expect{ { Code: 1, - Msg: &subPeersMsg{Depth: uint8(hive.depth)}, + Msg: &subPeersMsg{Depth: uint8(hiveDepth)}, Peer: control.ID(), }, },