fix compress

pull/291/head
刘河 2019-12-04 04:45:52 +08:00
parent 627ea612e6
commit fd71e0821f
1 changed files with 1 additions and 8 deletions

View File

@ -3,7 +3,6 @@ package conn
import ( import (
"io" "io"
"github.com/cnlh/nps/lib/common"
"github.com/golang/snappy" "github.com/golang/snappy"
) )
@ -32,13 +31,7 @@ func (s *SnappyConn) Write(b []byte) (n int, err error) {
//snappy压缩读 //snappy压缩读
func (s *SnappyConn) Read(b []byte) (n int, err error) { func (s *SnappyConn) Read(b []byte) (n int, err error) {
buf := common.BufPool.Get().([]byte) return s.r.Read(b)
defer common.BufPool.Put(buf)
if n, err = s.r.Read(buf); err != nil {
return
}
copy(b, buf[:n])
return
} }
func (s *SnappyConn) Close() error { func (s *SnappyConn) Close() error {