fix incorrect use of snappy pool (#3549)

This commit is contained in:
fatedier
2023-07-25 21:31:26 +08:00
committed by GitHub
parent 6430afcfa5
commit e9e12cf888
11 changed files with 22 additions and 25 deletions

View File

@ -175,9 +175,7 @@ func (pxy *HTTPProxy) GetRealConn(remoteAddr string) (workConn net.Conn, err err
}
}
if pxy.cfg.UseCompression {
var releaseFn func()
rwc, releaseFn = libio.WithCompressionFromPool(rwc)
defer releaseFn()
rwc = libio.WithCompression(rwc)
}
if pxy.GetLimiter() != nil {

View File

@ -241,9 +241,9 @@ func (pxy *BaseProxy) handleUserTCPConnection(userConn net.Conn) {
}
}
if cfg.UseCompression {
var releaseFn func()
local, releaseFn = libio.WithCompressionFromPool(local)
defer releaseFn()
var recycleFn func()
local, recycleFn = libio.WithCompressionFromPool(local)
defer recycleFn()
}
if pxy.GetLimiter() != nil {