app/vmselect/netstorage: improve error message when reading data size in readBytes

This commit is contained in:
Aliaksandr Valialkin 2019-12-24 14:40:04 +02:00
parent c0060c5858
commit 97de50dd4c

View File

@ -1305,8 +1305,8 @@ func writeBool(bc *handshake.BufferedConn, b bool) error {
func readBytes(buf []byte, bc *handshake.BufferedConn, maxDataSize int) ([]byte, error) { func readBytes(buf []byte, bc *handshake.BufferedConn, maxDataSize int) ([]byte, error) {
buf = bytesutil.Resize(buf, 8) buf = bytesutil.Resize(buf, 8)
if _, err := io.ReadFull(bc, buf); err != nil { if n, err := io.ReadFull(bc, buf); err != nil {
return buf, fmt.Errorf("error read data size: %s", err) return buf, fmt.Errorf("cannot read %d bytes with data size: %s; read only %d bytes", len(buf), err, n)
} }
dataSize := encoding.UnmarshalUint64(buf) dataSize := encoding.UnmarshalUint64(buf)
if dataSize > uint64(maxDataSize) { if dataSize > uint64(maxDataSize) {