刘河 5 år sedan
förälder
incheckning
fd71e0821f
1 ändrade filer med 1 tillägg och 8 borttagningar
  1. 1 8
      lib/conn/snappy.go

+ 1 - 8
lib/conn/snappy.go

@@ -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 {