mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-05 16:57:06 +08:00
update: 解析RDB格式错误处理
This commit is contained in:
@@ -4,13 +4,14 @@ import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"errors"
|
||||
"github.com/hdt3213/godis/interface/redis"
|
||||
"github.com/hdt3213/godis/lib/logger"
|
||||
"github.com/hdt3213/godis/redis/protocol"
|
||||
"io"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/hdt3213/godis/interface/redis"
|
||||
"github.com/hdt3213/godis/lib/logger"
|
||||
"github.com/hdt3213/godis/redis/protocol"
|
||||
)
|
||||
|
||||
// Payload stores redis.Reply or error
|
||||
@@ -155,6 +156,9 @@ func parseBulkString(header []byte, reader *bufio.Reader, ch chan<- *Payload) er
|
||||
// there is no CRLF between RDB and following AOF, therefore it needs to be treated differently
|
||||
func parseRDBBulkString(reader *bufio.Reader, ch chan<- *Payload) error {
|
||||
header, err := reader.ReadBytes('\n')
|
||||
if err != nil {
|
||||
return errors.New("failed to read bytes")
|
||||
}
|
||||
header = bytes.TrimSuffix(header, []byte{'\r', '\n'})
|
||||
if len(header) == 0 {
|
||||
return errors.New("empty header")
|
||||
|
Reference in New Issue
Block a user