mirror of https://github.com/gorilla/websocket.git
Merge pull request #10 from smith-30/feature/mod_add_dict
mod: add dict process
This commit is contained in:
commit
67b993939f
10
conn.go
10
conn.go
|
@ -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:]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue