mirror of
				https://github.com/ehang-io/nps
				synced 2025-10-26 21:27:10 +08:00 
			
		
		
		
	fix compress
This commit is contained in:
		
							parent
							
								
									627ea612e6
								
							
						
					
					
						commit
						fd71e0821f
					
				|  | @ -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 { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 刘河
						刘河