Browse Source

fix error msg

pull/965/head
Anton Kaliaev 7 years ago
parent
commit
af79a2a59e
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      consensus/wal.go

+ 4
- 4
consensus/wal.go View File

@ -257,7 +257,7 @@ func NewWALDecoder(rd io.Reader) *WALDecoder {
func (dec *WALDecoder) Decode() (*TimedWALMessage, error) {
b := make([]byte, 4)
n, err := dec.rd.Read(b)
_, err := dec.rd.Read(b)
if err == io.EOF {
return nil, err
}
@ -267,7 +267,7 @@ func (dec *WALDecoder) Decode() (*TimedWALMessage, error) {
crc := binary.BigEndian.Uint32(b)
b = make([]byte, 4)
n, err = dec.rd.Read(b)
_, err = dec.rd.Read(b)
if err == io.EOF {
return nil, err
}
@ -281,12 +281,12 @@ func (dec *WALDecoder) Decode() (*TimedWALMessage, error) {
}
data := make([]byte, length)
n, err = dec.rd.Read(data)
_, err = dec.rd.Read(data)
if err == io.EOF {
return nil, err
}
if err != nil {
return nil, fmt.Errorf("not enough bytes for data: %v (want: %d, read: %v)", err, length, n)
return nil, fmt.Errorf("failed to read data: %v", err)
}
// check checksum before decoding data


Loading…
Cancel
Save