forked from mirror/websocket
Fix compile error on Go < 1.6
This commit is contained in:
parent
522f286a67
commit
2257eda00b
|
@ -13,7 +13,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
minCompressionLevel = -2 // flate.HuffmanOnly
|
minCompressionLevel = -2 // flate.HuffmanOnly not defined in Go < 1.6
|
||||||
maxCompressionLevel = flate.BestCompression
|
maxCompressionLevel = flate.BestCompression
|
||||||
defaultCompressionLevel = 1
|
defaultCompressionLevel = 1
|
||||||
)
|
)
|
||||||
|
|
6
conn.go
6
conn.go
|
@ -1065,10 +1065,8 @@ func (c *Conn) EnableWriteCompression(enable bool) {
|
||||||
|
|
||||||
// SetCompressionLevel sets the flate compression level for subsequent text and
|
// SetCompressionLevel sets the flate compression level for subsequent text and
|
||||||
// binary messages. This function is a noop if compression was not negotiated
|
// binary messages. This function is a noop if compression was not negotiated
|
||||||
// with the peer. Valid levels range from -2 to 9. Level -1 uses the default
|
// with the peer. See the compress/flate package for a description of
|
||||||
// compression level. Level -2 uses Huffman compression only, Level 0 does not
|
// compression levels.
|
||||||
// attempt any compression. Levels 1 through 9 range from best speed to best
|
|
||||||
// compression.
|
|
||||||
func (c *Conn) SetCompressionLevel(level int) error {
|
func (c *Conn) SetCompressionLevel(level int) error {
|
||||||
if !isValidCompressionLevel(level) {
|
if !isValidCompressionLevel(level) {
|
||||||
return errors.New("websocket: invalid compression level")
|
return errors.New("websocket: invalid compression level")
|
||||||
|
|
Loading…
Reference in New Issue