Browse Source

p2p: refactor Switch#OnStop (#3729)

pull/3731/head
Runchao Han 5 years ago
committed by Anton Kaliaev
parent
commit
ed18ffdca3
2 changed files with 1 additions and 6 deletions
  1. +0
    -1
      node/node.go
  2. +1
    -5
      p2p/switch.go

+ 0
- 1
node/node.go View File

@ -714,7 +714,6 @@ func (n *Node) OnStop() {
n.indexerService.Stop()
// now stop the reactors
// TODO: gracefully disconnect from peers.
n.sw.Stop()
// stop mempool WAL


+ 1
- 5
p2p/switch.go View File

@ -221,11 +221,7 @@ func (sw *Switch) OnStart() error {
func (sw *Switch) OnStop() {
// Stop peers
for _, p := range sw.peers.List() {
sw.transport.Cleanup(p)
p.Stop()
if sw.peers.Remove(p) {
sw.metrics.Peers.Add(float64(-1))
}
sw.stopAndRemovePeer(p, nil)
}
// Stop reactors


Loading…
Cancel
Save