Skip to content

Commit

Permalink
fixes another subnet bug
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-hanna committed Oct 8, 2019
1 parent 061e798 commit 88169bb
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions cmd/subnet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,13 @@ func setup() *cobra.Command {

// start the subnet
start := make(chan struct{})
if err = snet.Start(start); err != nil {
logger.Errorf("err starting subnet\n%v", err)
return err
}
cErr := make(chan error)
go func(s *subnet.Subnet, strt chan struct{}, e chan error) {
if err = s.Start(strt); err != nil {
logger.Errorf("err starting subnet\n%v", err)
e <- err
}
}(snet, start, cErr)

select {
case <-start:
Expand All @@ -93,9 +96,12 @@ func setup() *cobra.Command {
// note: I don't like '^C' showing up on the same line as the next logged line...
fmt.Println("")
logger.Info("Received stop signal from os. Shutting down...")
}
return nil

return nil
case <-cErr:
logger.Errorf("received an error from the subnet:\n%v", err)
return err
}
},
}

Expand Down

0 comments on commit 88169bb

Please sign in to comment.