Merge pull request #2240 from nspcc-dev/fix-panic-in-network

Fix panic on peer disconnect
This commit is contained in:
Roman Khimov 2021-11-01 12:44:15 +03:00 committed by GitHub
commit fe50f6edc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -393,7 +393,7 @@ func (s *Server) run() {
s.lock.Unlock()
s.log.Warn("peer disconnected",
zap.Stringer("addr", drop.peer.RemoteAddr()),
zap.String("reason", drop.reason.Error()),
zap.Error(drop.reason),
zap.Int("peerCount", s.PeerCount()))
addr := drop.peer.PeerAddr().String()
if drop.reason == errIdenticalID {

View file

@ -179,8 +179,8 @@ func (p *TCPPeer) handleConn() {
p.incoming <- msg
}
}
close(p.incoming)
p.Disconnect(err)
close(p.incoming)
}
func (p *TCPPeer) handleIncoming() {