mirror of https://github.com/poanetwork/gecko.git
only exit the dispatch loop if the node is closing
This commit is contained in:
parent
7671cab972
commit
b8bd018938
|
@ -81,6 +81,7 @@ func main() {
|
|||
|
||||
defer node.Shutdown()
|
||||
|
||||
log.Debug("Dispatching node handlers")
|
||||
node.Dispatch()
|
||||
log.Debug("dispatching node handlers")
|
||||
err = node.Dispatch()
|
||||
log.Debug("dispatch returned with: %s", err)
|
||||
}
|
||||
|
|
|
@ -485,8 +485,16 @@ func (n *network) Dispatch() error {
|
|||
for {
|
||||
conn, err := n.listener.Accept()
|
||||
if err != nil {
|
||||
n.stateLock.Lock()
|
||||
closed := n.closed
|
||||
n.stateLock.Unlock()
|
||||
|
||||
if closed {
|
||||
return err
|
||||
}
|
||||
n.log.Debug("error during server accept: %s", err)
|
||||
continue
|
||||
}
|
||||
go n.upgrade(&peer{
|
||||
net: n,
|
||||
conn: conn,
|
||||
|
|
|
@ -195,7 +195,7 @@ func (i *insecureValidatorManager) Disconnected(vdrID ids.ShortID) bool {
|
|||
|
||||
// Dispatch starts the node's servers.
|
||||
// Returns when the node exits.
|
||||
func (n *Node) Dispatch() {
|
||||
func (n *Node) Dispatch() error {
|
||||
// Add bootstrap nodes to the peer network
|
||||
for _, peer := range n.Config.BootstrapPeers {
|
||||
if !peer.IP.Equal(n.Config.StakingIP) {
|
||||
|
@ -205,7 +205,7 @@ func (n *Node) Dispatch() {
|
|||
}
|
||||
}
|
||||
|
||||
n.Net.Dispatch()
|
||||
return n.Net.Dispatch()
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue