From e9eadea7571610af8465d1a75c264bc6b22171d8 Mon Sep 17 00:00:00 2001 From: hdt3213 Date: Wed, 8 May 2024 07:38:50 +0800 Subject: [PATCH] fix encoder issue #34 #35 --- core/encoder.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/encoder.go b/core/encoder.go index 79c8903..7012bec 100644 --- a/core/encoder.go +++ b/core/encoder.go @@ -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), @@ -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]