From 1c28dd2567df14ea88603ce1e7ff21266ed6d4da Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 28 Jan 2020 16:38:39 +0300 Subject: [PATCH] network: add message type to disconnect error message If it was caused by message processing, but only after the handshake to preserve errIdenticalID and other handshaking errors. --- pkg/network/tcp_peer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/network/tcp_peer.go b/pkg/network/tcp_peer.go index 1dfbbcc44..80ce6c695 100644 --- a/pkg/network/tcp_peer.go +++ b/pkg/network/tcp_peer.go @@ -2,6 +2,7 @@ package network import ( "errors" + "fmt" "net" "strconv" "sync" @@ -131,6 +132,9 @@ func (p *TCPPeer) handleConn() { break } if err = p.server.handleMessage(p, msg); err != nil { + if p.Handshaked() { + err = fmt.Errorf("handling %s message: %v", msg.CommandType(), err) + } break } }