Skip to content

Commit

Permalink
add and move conditions in StopNode
Browse files Browse the repository at this point in the history
  • Loading branch information
adambabik committed Aug 31, 2017
1 parent 8d02ba4 commit 3ef9a88
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions geth/node/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,20 @@ func (m *NodeManager) StopNode() (<-chan struct{}, error) {
m.Lock()
defer m.Unlock()

return m.stopNode()
}

// stopNode stop Status node. Stopped node cannot be resumed.
func (m *NodeManager) stopNode() (<-chan struct{}, error) {
if err := m.isNodeAvailable(); err != nil {
return nil, err
}
if m.nodeStopped == nil {
return nil, ErrNoRunningNode
}

<-m.nodeStarted // make sure you operate on fully started node

return m.stopNode()
}

// stopNode stop Status node. Stopped node cannot be resumed.
func (m *NodeManager) stopNode() (<-chan struct{}, error) {
// now attempt to stop
if err := m.node.Stop(); err != nil {
return nil, err
Expand Down

0 comments on commit 3ef9a88

Please sign in to comment.