diff options
author | Janoš Guljaš <janos@users.noreply.github.com> | 2019-01-16 19:56:34 +0800 |
---|---|---|
committer | Rafael Matias <rafael@skyle.net> | 2019-02-19 19:54:10 +0800 |
commit | e63995b3f36837b97330a7ccaf56277099904d26 (patch) | |
tree | 814a1c0b52d5b19cb141644b803d9a0fa0429641 /swarm | |
parent | dd3e89474777b39b7bea646796de594449ea2304 (diff) | |
download | dexon-e63995b3f36837b97330a7ccaf56277099904d26.tar.gz dexon-e63995b3f36837b97330a7ccaf56277099904d26.tar.zst dexon-e63995b3f36837b97330a7ccaf56277099904d26.zip |
swarm/network: fix data race in TestNetworkID test (#18460)
(cherry picked from commit 96c7c18b184ae894f1c6bd5fbfc45fbcfa9ace77)
Diffstat (limited to 'swarm')
-rw-r--r-- | swarm/network/networkid_test.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/swarm/network/networkid_test.go b/swarm/network/networkid_test.go index 99890118f..8e68e5b52 100644 --- a/swarm/network/networkid_test.go +++ b/swarm/network/networkid_test.go @@ -76,13 +76,12 @@ func TestNetworkID(t *testing.T) { if err != nil { t.Fatalf("Error setting up network: %v", err) } - defer func() { - //shutdown the snapshot network - log.Trace("Shutting down network") - net.Shutdown() - }() //let's sleep to ensure all nodes are connected time.Sleep(1 * time.Second) + // shutdown the the network to avoid race conditions + // on accessing kademlias global map while network nodes + // are accepting messages + net.Shutdown() //for each group sharing the same network ID... for _, netIDGroup := range nodeMap { log.Trace("netIDGroup size", "size", len(netIDGroup)) |