mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-25 01:14:28 +00:00
p2p: refactor Switch#OnStop (#3729)
This commit is contained in:
committed by
Anton Kaliaev
parent
0e1c492d3e
commit
ed18ffdca3
@@ -714,7 +714,6 @@ func (n *Node) OnStop() {
|
|||||||
n.indexerService.Stop()
|
n.indexerService.Stop()
|
||||||
|
|
||||||
// now stop the reactors
|
// now stop the reactors
|
||||||
// TODO: gracefully disconnect from peers.
|
|
||||||
n.sw.Stop()
|
n.sw.Stop()
|
||||||
|
|
||||||
// stop mempool WAL
|
// stop mempool WAL
|
||||||
|
|||||||
+1
-5
@@ -221,11 +221,7 @@ func (sw *Switch) OnStart() error {
|
|||||||
func (sw *Switch) OnStop() {
|
func (sw *Switch) OnStop() {
|
||||||
// Stop peers
|
// Stop peers
|
||||||
for _, p := range sw.peers.List() {
|
for _, p := range sw.peers.List() {
|
||||||
sw.transport.Cleanup(p)
|
sw.stopAndRemovePeer(p, nil)
|
||||||
p.Stop()
|
|
||||||
if sw.peers.Remove(p) {
|
|
||||||
sw.metrics.Peers.Add(float64(-1))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop reactors
|
// Stop reactors
|
||||||
|
|||||||
Reference in New Issue
Block a user