diff --git a/node/node.go b/node/node.go index 6ee027710..b739396d4 100644 --- a/node/node.go +++ b/node/node.go @@ -44,6 +44,7 @@ type Node struct { genesisDoc *types.GenesisDoc privKey crypto.PrivKeyEd25519 proxyApp proxy.AppConns + rpcListeners []net.Listener } func NewNodeDefault(config cfg.Config) *Node { @@ -208,10 +209,11 @@ func (n *Node) OnStart() error { // Run the RPC server if n.config.GetString("rpc_laddr") != "" { - _, err := n.startRPC() + listeners, err := n.startRPC() if err != nil { return err } + n.rpcListeners = listeners } return nil @@ -230,6 +232,13 @@ func (n *Node) OnStop() { log.Notice("Stopping Node") // TODO: gracefully disconnect from peers. n.sw.Stop() + + for _, l := range n.rpcListeners { + log.Info("Closing rpc listener", "listener", l) + if err := l.Close(); err != nil { + log.Error("Error closing listener", "listener", l, "error", err) + } + } } // Add the event switch to reactors, mempool, etc. diff --git a/test/persist/test_failure_indices.sh b/test/persist/test_failure_indices.sh index ba09464fa..04118c728 100644 --- a/test/persist/test_failure_indices.sh +++ b/test/persist/test_failure_indices.sh @@ -45,8 +45,8 @@ function kill_procs(){ wait "$PID_TENDERMINT" # wait for the ports to be released - wait_for_port 46656 - wait_for_port 46657 + #wait_for_port 46656 + #wait_for_port 46657 } # wait for port to be available