Merge pull request #1185 from nspcc-dev/fix-panic-on-shutdown-2.x

network: copy peers for Shutdown iteration
This commit is contained in:
Roman Khimov 2020-07-16 16:23:58 +03:00 committed by GitHub
commit 38c195fea9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -191,7 +191,7 @@ func (s *Server) Shutdown() {
s.log.Info("shutting down server", zap.Int("peers", s.PeerCount()))
s.transport.Close()
s.discovery.Close()
for p := range s.peers {
for p := range s.Peers() {
p.Disconnect(errServerShutdown)
}
s.bQueue.discard()