Skip to content

Commit e37ade0

Browse files
committed
cmd/swarm/swarm-snapshot, swarm/network/simulations: removed redundant connection event check, fixed lint error
1 parent b866ba9 commit e37ade0

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

cmd/swarm/swarm-snapshot/create.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ import (
3838
cli "gopkg.in/urfave/cli.v1"
3939
)
4040

41-
const noConnectionTimeout = 1 * time.Second
42-
4341
// create is used as the entry function for "create" app command.
4442
func create(ctx *cli.Context) error {
4543
log.PrintOrigins(true)
@@ -83,20 +81,6 @@ func createSnapshot(filename string, nodes int, services []string) (err error) {
8381
return fmt.Errorf("add nodes: %v", err)
8482
}
8583

86-
// wait for two some time to ensure no connections
87-
// are established
88-
events := make(chan *simulations.Event)
89-
sub := sim.Net.Events().Subscribe(events)
90-
select {
91-
case ev := <-events:
92-
//only catch node up events
93-
if ev.Type == simulations.EventTypeConn {
94-
return errors.New("unexpected connection events")
95-
}
96-
case <-time.After(noConnectionTimeout):
97-
}
98-
sub.Unsubscribe()
99-
10084
err = sim.Net.ConnectNodesRing(nil)
10185
if err != nil {
10286
return fmt.Errorf("connect nodes: %v", err)

swarm/network/simulations/discovery/discovery_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,10 @@ func getDbStore(nodeID string) (*state.DBStore, error) {
8282
}
8383

8484
var (
85-
nodeCount = flag.Int("nodes", 10, "number of nodes to create (default 10)")
86-
initCount = flag.Int("conns", 1, "number of originally connected peers (default 1)")
87-
loglevel = flag.Int("loglevel", 3, "verbosity of logs")
88-
rawlog = flag.Bool("rawlog", false, "remove terminal formatting from logs")
89-
serviceOverride = flag.String("services", "", "remove or add services to the node snapshot; prefix with \"+\" to add, \"-\" to remove; example: +pss,-discovery")
85+
nodeCount = flag.Int("nodes", 10, "number of nodes to create (default 10)")
86+
initCount = flag.Int("conns", 1, "number of originally connected peers (default 1)")
87+
loglevel = flag.Int("loglevel", 3, "verbosity of logs")
88+
rawlog = flag.Bool("rawlog", false, "remove terminal formatting from logs")
9089
)
9190

9291
func init() {

0 commit comments

Comments
 (0)