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.
This commit is contained in:
Roman Khimov 2020-01-28 16:38:39 +03:00
parent b79abd1e27
commit 1c28dd2567

View file

@ -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
}
}