Skip to content

Commit

Permalink
fix encoder issue #34 #35
Browse files Browse the repository at this point in the history
  • Loading branch information
HDT3213 committed May 7, 2024
1 parent d16ee77 commit e9eadea
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ var stateChanges = map[string]map[string]struct{}{ // state -> allow next states
writtenEndState: {},
}

const Crc64Jones = 0xad93d23594c935a9

// NewEncoder creates an encoder instance
func NewEncoder(writer io.Writer) *Encoder {
crcTab := crc64.MakeTable(crc64.ISO)
crcTab := crc64.MakeTable(Crc64Jones)
return &Encoder{
writer: writer,
crc: crc64.New(crcTab),
Expand Down Expand Up @@ -147,7 +149,7 @@ func (enc *Encoder) write(p []byte) error {
return nil
}

var rdbHeader = []byte("REDIS0003")
var rdbHeader = []byte("REDIS0005")

func (enc *Encoder) validateStateChange(toState string) bool {
_, ok := stateChanges[enc.state][toState]
Expand Down

0 comments on commit e9eadea

Please sign in to comment.