diff options
author | lash <nolash@users.noreply.github.com> | 2019-03-23 04:37:25 +0800 |
---|---|---|
committer | Viktor TrĂ³n <viktor.tron@gmail.com> | 2019-03-23 04:37:25 +0800 |
commit | 2f5b6cb442dd1ab20279603de938e5b60e3122fb (patch) | |
tree | 1637681558132f2b1064e7d774b9ca63047f72a4 /swarm/network/simulation/simulation.go | |
parent | 876f3573647f9a62d94073b342bc678f380f0304 (diff) | |
download | go-tangerine-2f5b6cb442dd1ab20279603de938e5b60e3122fb.tar go-tangerine-2f5b6cb442dd1ab20279603de938e5b60e3122fb.tar.gz go-tangerine-2f5b6cb442dd1ab20279603de938e5b60e3122fb.tar.bz2 go-tangerine-2f5b6cb442dd1ab20279603de938e5b60e3122fb.tar.lz go-tangerine-2f5b6cb442dd1ab20279603de938e5b60e3122fb.tar.xz go-tangerine-2f5b6cb442dd1ab20279603de938e5b60e3122fb.tar.zst go-tangerine-2f5b6cb442dd1ab20279603de938e5b60e3122fb.zip |
swarm/network: Use different privatekey for bzz overlay in sim (#19313)
* cmd/swarm, p2p, swarm: Enable ENR in binary/execadapter
* cmd/p2p/swarm: Remove comments + config.Enode nomarshal
* p2p/simulations: Remove superfluous error check
* p2p/simulation: Move init enode comment
* swarm, p2p/simulations, cmd/swarm: Use nodekey in binary record sign
* swarm/network, swarm/pss: Dervice bzzkey
* swarm/pss: Remove unused function
* swarm/network: Store swarm private key in simulation bucket
* swarm/pss: Shorten TextProxNetwork shortrunning test timeout
* swarm/pss: Increase prox test timeout
* swarm/pss: Increase timeout slightly on shortrunning proxtest
* swarm/network: Simplify bucket instantiation in servicectx func
* p2p/simulations: Tcpport -> udpport
* swarm/network, swarm/pss: Simplify + correct lock in servicefunc sim
* swarm/network: Cleanup after rebase on extract swarm enode new
* p2p/simulations, swarm/network: Make exec disc test pass
* swarm/network: Prune ye olde comment
* swarm/pss: Correct revised bzzkey method call
* swarm/network: Clarify comment about privatekey generation data
* swarm/pss: Fix syntax errors after rebase
* swarm/network: Rename misleadingly named method
(amend commit to trigger ci - attempt 5)
Diffstat (limited to 'swarm/network/simulation/simulation.go')
-rw-r--r-- | swarm/network/simulation/simulation.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/swarm/network/simulation/simulation.go b/swarm/network/simulation/simulation.go index e18d19a67..5787cafda 100644 --- a/swarm/network/simulation/simulation.go +++ b/swarm/network/simulation/simulation.go @@ -85,13 +85,16 @@ func New(services map[string]ServiceFunc) (s *Simulation) { name, serviceFunc := name, serviceFunc s.serviceNames = append(s.serviceNames, name) adapterServices[name] = func(ctx *adapters.ServiceContext) (node.Service, error) { - b := new(sync.Map) + s.mu.Lock() + defer s.mu.Unlock() + b, ok := s.buckets[ctx.Config.ID] + if !ok { + b = new(sync.Map) + } service, cleanup, err := serviceFunc(ctx, b) if err != nil { return nil, err } - s.mu.Lock() - defer s.mu.Unlock() if cleanup != nil { s.cleanupFuncs = append(s.cleanupFuncs, cleanup) } |