fix a race condition issue (#3536)

This commit is contained in:
fatedier
2023-07-20 22:32:32 +08:00
committed by GitHub
parent 90861b6821
commit efcc028a3d
12 changed files with 34 additions and 14 deletions

View File

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

View File

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