Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ type Conn struct {
contextTakeover bool
txDict []byte
rxDict []byte
mutex sync.RWMutex
}

func newConn(conn net.Conn, isServer bool, readBufferSize, writeBufferSize int) *Conn {
Expand Down Expand Up @@ -1168,27 +1167,17 @@ func (c *Conn) SetCompressionLevel(level int) error {
return nil
}

// AddTxDict adds payload to txDict.
func (c *Conn) AddTxDict(b []byte) {
c.mutex.Lock()
defer c.mutex.Unlock()

// Todo I do not know whether to leave the dictionary with 32768 bytes or more
// If it is recognized as a duplicate character string,
// deleting a part of the character may make it impossible to decrypt it.
c.txDict = append(b, c.txDict...)

if len(c.txDict) > maxWindowBits {
c.txDict = c.txDict[:maxWindowBits]
}
}

// AddTxDict adds payload to rxDict.
func (c *Conn) AddRxDict(b []byte) {
c.mutex.Lock()
defer c.mutex.Unlock()

// Todo I do not know whether to leave the dictionary with 32768 bytes or more
// If it is recognized as a duplicate character string,
// deleting a part of the character may make it impossible to decrypt it.
c.rxDict = append(b, c.rxDict...)

if len(c.rxDict) > maxWindowBits {
Expand Down