mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 23:25:22 +00:00
network: don't panic if there is no reason for disconnect
Although error should always be there, we shouldn't fail like this if it's not: | panic: runtime error: invalid memory address or nil pointer dereference | [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xc8884c] | | goroutine 113 [running]: | github.com/nspcc-dev/neo-go/pkg/network.(*Server).run(0xc000150580) | github.com/nspcc-dev/neo-go/pkg/network/server.go:396 +0x7ac | github.com/nspcc-dev/neo-go/pkg/network.(*Server).Start(0xc000150580, 0x0) | github.com/nspcc-dev/neo-go/pkg/network/server.go:294 +0x3fb | created by github.com/nspcc-dev/neo-go/cli/server.startServer | github.com/nspcc-dev/neo-go/cli/server/server.go:344 +0x56f
This commit is contained in:
parent
67eac3a27f
commit
2eeec73770
1 changed files with 1 additions and 1 deletions
|
@ -393,7 +393,7 @@ func (s *Server) run() {
|
||||||
s.lock.Unlock()
|
s.lock.Unlock()
|
||||||
s.log.Warn("peer disconnected",
|
s.log.Warn("peer disconnected",
|
||||||
zap.Stringer("addr", drop.peer.RemoteAddr()),
|
zap.Stringer("addr", drop.peer.RemoteAddr()),
|
||||||
zap.String("reason", drop.reason.Error()),
|
zap.Error(drop.reason),
|
||||||
zap.Int("peerCount", s.PeerCount()))
|
zap.Int("peerCount", s.PeerCount()))
|
||||||
addr := drop.peer.PeerAddr().String()
|
addr := drop.peer.PeerAddr().String()
|
||||||
if drop.reason == errIdenticalID {
|
if drop.reason == errIdenticalID {
|
||||||
|
|
Loading…
Reference in a new issue