Skip to content

Commit

Permalink
Fix logger initialization in encoder decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaokangwang committed Mar 22, 2024
1 parent 0d937fc commit 1f04144
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/framing/framing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions riverrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 1f04144

Please sign in to comment.