fix pool timer leak bug, resolve#3353 (#3358)

When remove peer, block pool simple remove bpPeer,
but do not stop timer, that cause stopError for recorrected
peers. Stop timer when remove from pool.
This commit is contained in:
zjubfd 2019-03-03 04:21:21 +08:00 committed by Ethan Buchman
parent d95894152b
commit 976b1c2ef7

View File

@ -299,6 +299,9 @@ func (pool *BlockPool) removePeer(peerID p2p.ID) {
requester.redo(peerID)
}
}
if p, exist := pool.peers[peerID]; exist && p.timeout != nil {
p.timeout.Stop()
}
delete(pool.peers, peerID)
}