From 1f041445f73f34550c57c97949546c6025a74f65 Mon Sep 17 00:00:00 2001 From: Shelikhoo Date: Fri, 22 Mar 2024 14:43:48 +0000 Subject: [PATCH] Fix logger initialization in encoder decoder --- common/framing/framing.go | 4 ++++ riverrun.go | 1 + 2 files changed, 5 insertions(+) diff --git a/common/framing/framing.go b/common/framing/framing.go index b21df65..14fc41e 100644 --- a/common/framing/framing.go +++ b/common/framing/framing.go @@ -160,6 +160,10 @@ type BaseDecoder struct { logger log.Logger } +func (decoder *BaseDecoder) SetLogger(logger log.Logger) { + decoder.logger = logger +} + func (decoder *BaseDecoder) InitBuffers() { decoder.ReceiveBuffer = bytes.NewBuffer(nil) decoder.ReceiveDecodedBuffer = bytes.NewBuffer(nil) diff --git a/riverrun.go b/riverrun.go index b10ff6a..441092e 100644 --- a/riverrun.go +++ b/riverrun.go @@ -266,6 +266,7 @@ type riverrunDecoder struct { func newRiverrunDecoder(key []byte, readStream cipher.Stream, revTable8, revTable16 map[uint64]uint64, compressedBlockBits, expandedBlockBits uint64, logger log.Logger) *riverrunDecoder { decoder := new(riverrunDecoder) decoder.logger = logger + decoder.BaseDecoder.SetLogger(logger) decoder.Drbg = f.GenDrbg(key[:]) decoder.LengthLength = int(ctstretch.ExpandedNBytes(uint64(f.LengthLength), compressedBlockBits, expandedBlockBits))