mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
cmd/swarm/swarm-snapshot, swarm/network/simulations: removed redundant connection event check, fixed lint error
This commit is contained in:
parent
b866ba97b8
commit
e37ade0671
2 changed files with 4 additions and 21 deletions
|
|
@ -38,8 +38,6 @@ import (
|
||||||
cli "gopkg.in/urfave/cli.v1"
|
cli "gopkg.in/urfave/cli.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
const noConnectionTimeout = 1 * time.Second
|
|
||||||
|
|
||||||
// create is used as the entry function for "create" app command.
|
// create is used as the entry function for "create" app command.
|
||||||
func create(ctx *cli.Context) error {
|
func create(ctx *cli.Context) error {
|
||||||
log.PrintOrigins(true)
|
log.PrintOrigins(true)
|
||||||
|
|
@ -83,20 +81,6 @@ func createSnapshot(filename string, nodes int, services []string) (err error) {
|
||||||
return fmt.Errorf("add nodes: %v", err)
|
return fmt.Errorf("add nodes: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait for two some time to ensure no connections
|
|
||||||
// are established
|
|
||||||
events := make(chan *simulations.Event)
|
|
||||||
sub := sim.Net.Events().Subscribe(events)
|
|
||||||
select {
|
|
||||||
case ev := <-events:
|
|
||||||
//only catch node up events
|
|
||||||
if ev.Type == simulations.EventTypeConn {
|
|
||||||
return errors.New("unexpected connection events")
|
|
||||||
}
|
|
||||||
case <-time.After(noConnectionTimeout):
|
|
||||||
}
|
|
||||||
sub.Unsubscribe()
|
|
||||||
|
|
||||||
err = sim.Net.ConnectNodesRing(nil)
|
err = sim.Net.ConnectNodesRing(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("connect nodes: %v", err)
|
return fmt.Errorf("connect nodes: %v", err)
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,6 @@ var (
|
||||||
initCount = flag.Int("conns", 1, "number of originally connected peers (default 1)")
|
initCount = flag.Int("conns", 1, "number of originally connected peers (default 1)")
|
||||||
loglevel = flag.Int("loglevel", 3, "verbosity of logs")
|
loglevel = flag.Int("loglevel", 3, "verbosity of logs")
|
||||||
rawlog = flag.Bool("rawlog", false, "remove terminal formatting from logs")
|
rawlog = flag.Bool("rawlog", false, "remove terminal formatting from logs")
|
||||||
serviceOverride = flag.String("services", "", "remove or add services to the node snapshot; prefix with \"+\" to add, \"-\" to remove; example: +pss,-discovery")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue