swarm/network: Rename minproxbinsize, add as member of simulation (#18408)

* swarm/network: Rename minproxbinsize, add as member of simulation

* swarm/network: Deactivate WaitTillHealthy, unreliable pending suggestpeer
This commit is contained in:
lash
2019-01-10 12:33:51 +01:00
committed by Viktor Trón
parent 7ca40306af
commit 7240f4d800
19 changed files with 93 additions and 84 deletions

View File

@ -28,6 +28,7 @@ import (
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/p2p/simulations"
"github.com/ethereum/go-ethereum/p2p/simulations/adapters"
"github.com/ethereum/go-ethereum/swarm/network"
)
// Common errors that are returned by functions in this package.
@ -42,13 +43,14 @@ type Simulation struct {
// of p2p/simulations.Network.
Net *simulations.Network
serviceNames []string
cleanupFuncs []func()
buckets map[enode.ID]*sync.Map
pivotNodeID *enode.ID
shutdownWG sync.WaitGroup
done chan struct{}
mu sync.RWMutex
serviceNames []string
cleanupFuncs []func()
buckets map[enode.ID]*sync.Map
pivotNodeID *enode.ID
shutdownWG sync.WaitGroup
done chan struct{}
mu sync.RWMutex
neighbourhoodSize int
httpSrv *http.Server //attach a HTTP server via SimulationOptions
handler *simulations.Server //HTTP handler for the server
@ -72,8 +74,9 @@ type ServiceFunc func(ctx *adapters.ServiceContext, bucket *sync.Map) (s node.Se
// which is used to start node.Service returned by ServiceFunc.
func New(services map[string]ServiceFunc) (s *Simulation) {
s = &Simulation{
buckets: make(map[enode.ID]*sync.Map),
done: make(chan struct{}),
buckets: make(map[enode.ID]*sync.Map),
done: make(chan struct{}),
neighbourhoodSize: network.NewKadParams().NeighbourhoodSize,
}
adapterServices := make(map[string]adapters.ServiceFunc, len(services))