Skip to content

Commit

Permalink
Merge pull request #362 from aceld/feature/aceld
Browse files Browse the repository at this point in the history
delete FrameDecoder lock, delete Decode() lock
  • Loading branch information
aceld authored Jan 6, 2025
2 parents 96cf8d2 + 5e50389 commit 4df75dd
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions zinterceptor/framedecoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import (
"bytes"
"encoding/binary"
"fmt"
"math"
"sync"

"github.com/aceld/zinx/ziface"
"math"
)

// FrameDecoder
Expand Down Expand Up @@ -315,7 +313,6 @@ type FrameDecoder struct {
tooLongFrameLength int64 // When the length of a packet exceeds maxLength, discard mode is enabled, and this field records the length of the data to be discarded (当某个数据包的长度超过maxLength,则开启丢弃模式,此字段记录需要丢弃的数据长度)
bytesToDiscard int64 // Records how many bytes still need to be discarded (记录还剩余多少字节需要丢弃)
in []byte
lock sync.Mutex
}

func NewFrameDecoder(lf ziface.LengthField) ziface.IFrameDecoder {
Expand Down Expand Up @@ -579,8 +576,6 @@ func (d *FrameDecoder) decode(buf []byte) []byte {
}

func (d *FrameDecoder) Decode(buff []byte) [][]byte {
d.lock.Lock()
defer d.lock.Unlock()

d.in = append(d.in, buff...)
resp := make([][]byte, 0)
Expand Down

0 comments on commit 4df75dd

Please sign in to comment.