mirror of https://github.com/ehang-io/nps
fix compress
parent
627ea612e6
commit
fd71e0821f
|
@ -3,7 +3,6 @@ package conn
|
|||
import (
|
||||
"io"
|
||||
|
||||
"github.com/cnlh/nps/lib/common"
|
||||
"github.com/golang/snappy"
|
||||
)
|
||||
|
||||
|
@ -32,13 +31,7 @@ func (s *SnappyConn) Write(b []byte) (n int, err error) {
|
|||
|
||||
//snappy压缩读
|
||||
func (s *SnappyConn) Read(b []byte) (n int, err error) {
|
||||
buf := common.BufPool.Get().([]byte)
|
||||
defer common.BufPool.Put(buf)
|
||||
if n, err = s.r.Read(buf); err != nil {
|
||||
return
|
||||
}
|
||||
copy(b, buf[:n])
|
||||
return
|
||||
return s.r.Read(b)
|
||||
}
|
||||
|
||||
func (s *SnappyConn) Close() error {
|
||||
|
|
Loading…
Reference in New Issue