mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-28 07:36:44 +00:00
swarm/network: Support disabling discovery for overlay sim
Signed-off-by: Lewis Marshall <lewis@lmars.net>
This commit is contained in:
parent
74d40d67b0
commit
fc904b482c
1 changed files with 6 additions and 0 deletions
|
|
@ -6,6 +6,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
|
|
@ -22,6 +23,8 @@ import (
|
|||
"github.com/ethereum/go-ethereum/swarm/network"
|
||||
)
|
||||
|
||||
var noDiscovery = flag.Bool("no-discovery", false, "disable discovery (useful if you want to load a snapshot)")
|
||||
|
||||
type Simulation struct {
|
||||
mtx sync.Mutex
|
||||
stores map[discover.NodeID]*adapters.SimStateStore
|
||||
|
|
@ -57,6 +60,7 @@ func (s *Simulation) NewService(ctx *adapters.ServiceContext) (node.Service, err
|
|||
ticker := time.NewTicker(time.Duration(kad.PruneInterval) * time.Millisecond)
|
||||
kad.Prune(ticker.C)
|
||||
hp := network.NewHiveParams()
|
||||
hp.Discovery = !*noDiscovery
|
||||
hp.KeepAliveInterval = 3 * time.Second
|
||||
|
||||
config := &network.BzzConfig{
|
||||
|
|
@ -192,6 +196,8 @@ func startStopMocker(net *simulations.Network) {
|
|||
|
||||
// var server
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
|
||||
log.Root().SetHandler(log.LvlFilterHandler(log.LvlDebug, log.StreamHandler(os.Stderr, log.TerminalFormat(false))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue