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 53ff170 commit 0d937fc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions riverrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ func (decoder *riverrunDecoder) payloadOverhead(payloadLen int) int {

func newRiverrunEncoder(key []byte, writeStream cipher.Stream, table8, table16 []uint64, compressedBlockBits, expandedBlockBits uint64, logger log.Logger) *riverrunEncoder {
encoder := new(riverrunEncoder)
encoder.logger = logger

encoder.Drbg = f.GenDrbg(key[:])
encoder.MaxPacketPayloadLength = int(ctstretch.CompressedNBytes_floor(f.MaximumSegmentLength-ctstretch.ExpandedNBytes(uint64(f.LengthLength), compressedBlockBits, expandedBlockBits), expandedBlockBits, compressedBlockBits))
Expand All @@ -219,8 +220,6 @@ func newRiverrunEncoder(key []byte, writeStream cipher.Stream, table8, table16 [

encoder.Type = "rr"

encoder.logger = logger

return encoder
}

Expand Down Expand Up @@ -266,6 +265,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.Drbg = f.GenDrbg(key[:])
decoder.LengthLength = int(ctstretch.ExpandedNBytes(uint64(f.LengthLength), compressedBlockBits, expandedBlockBits))
Expand All @@ -291,7 +291,6 @@ func newRiverrunDecoder(key []byte, readStream cipher.Stream, revTable8, revTabl
decoder.compressedBlockBits = compressedBlockBits
decoder.expandedBlockBits = expandedBlockBits

decoder.logger = logger
return decoder
}

Expand Down

0 comments on commit 0d937fc

Please sign in to comment.