Skip to content

Commit

Permalink
Merge pull request #10 from smith-30/feature/mod_add_dict
Browse files Browse the repository at this point in the history
mod: add dict process
  • Loading branch information
smith-30 authored Jan 25, 2018
2 parents bf99740 + 80a8097 commit 67b9939
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -1169,19 +1169,21 @@ func (c *Conn) SetCompressionLevel(level int) error {

// AddTxDict adds payload to txDict.
func (c *Conn) AddTxDict(b []byte) {
c.txDict = append(b, c.txDict...)
c.txDict = append(c.txDict, b...)

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

// AddTxDict adds payload to rxDict.
func (c *Conn) AddRxDict(b []byte) {
c.rxDict = append(b, c.rxDict...)
c.rxDict = append(c.rxDict, b...)

if len(c.rxDict) > maxWindowBits {
c.rxDict = c.rxDict[:maxWindowBits]
offset := len(c.rxDict) - maxWindowBits
c.rxDict = c.rxDict[offset:]
}
}

Expand Down

0 comments on commit 67b9939

Please sign in to comment.