mirror of
https://github.com/fatedier/frp.git
synced 2024-12-04 02:36:39 +08:00
fix incorrect use of snappy pool (#3549)
This commit is contained in:
parent
6430afcfa5
commit
e9e12cf888
@ -5,3 +5,4 @@
|
|||||||
### Fixes
|
### Fixes
|
||||||
|
|
||||||
* fix a goroutine leak issue caused by Login plugin timeout.
|
* fix a goroutine leak issue caused by Login plugin timeout.
|
||||||
|
* Fix an issue introduced in version 0.51.1, enabling `use_compression` will cause some requests to fail.
|
||||||
|
@ -142,10 +142,9 @@ func (pxy *BaseProxy) HandleTCPWorkConnection(workConn net.Conn, m *msg.StartWor
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var compressionResourceRecycleFn func()
|
||||||
if baseConfig.UseCompression {
|
if baseConfig.UseCompression {
|
||||||
var releaseFn func()
|
remote, compressionResourceRecycleFn = libio.WithCompressionFromPool(remote)
|
||||||
remote, releaseFn = libio.WithCompressionFromPool(remote)
|
|
||||||
defer releaseFn()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if we need to send proxy protocol info
|
// check if we need to send proxy protocol info
|
||||||
@ -215,4 +214,7 @@ func (pxy *BaseProxy) HandleTCPWorkConnection(workConn net.Conn, m *msg.StartWor
|
|||||||
if len(errs) > 0 {
|
if len(errs) > 0 {
|
||||||
xl.Trace("join connections errors: %v", errs)
|
xl.Trace("join connections errors: %v", errs)
|
||||||
}
|
}
|
||||||
|
if compressionResourceRecycleFn != nil {
|
||||||
|
compressionResourceRecycleFn()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,9 +97,7 @@ func (pxy *SUDPProxy) InWorkConn(conn net.Conn, _ *msg.StartWorkConn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if pxy.cfg.UseCompression {
|
if pxy.cfg.UseCompression {
|
||||||
var releaseFn func()
|
rwc = libio.WithCompression(rwc)
|
||||||
rwc, releaseFn = libio.WithCompressionFromPool(rwc)
|
|
||||||
defer releaseFn()
|
|
||||||
}
|
}
|
||||||
conn = utilnet.WrapReadWriteCloserToConn(rwc, conn)
|
conn = utilnet.WrapReadWriteCloserToConn(rwc, conn)
|
||||||
|
|
||||||
|
@ -108,9 +108,7 @@ func (pxy *UDPProxy) InWorkConn(conn net.Conn, _ *msg.StartWorkConn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if pxy.cfg.UseCompression {
|
if pxy.cfg.UseCompression {
|
||||||
var releaseFn func()
|
rwc = libio.WithCompression(rwc)
|
||||||
rwc, releaseFn = libio.WithCompressionFromPool(rwc)
|
|
||||||
defer releaseFn()
|
|
||||||
}
|
}
|
||||||
conn = utilnet.WrapReadWriteCloserToConn(rwc, conn)
|
conn = utilnet.WrapReadWriteCloserToConn(rwc, conn)
|
||||||
|
|
||||||
|
@ -126,9 +126,9 @@ func (sv *STCPVisitor) handleConn(userConn net.Conn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if sv.cfg.UseCompression {
|
if sv.cfg.UseCompression {
|
||||||
var releaseFn func()
|
var recycleFn func()
|
||||||
remote, releaseFn = libio.WithCompressionFromPool(remote)
|
remote, recycleFn = libio.WithCompressionFromPool(remote)
|
||||||
defer releaseFn()
|
defer recycleFn()
|
||||||
}
|
}
|
||||||
|
|
||||||
libio.Join(userConn, remote)
|
libio.Join(userConn, remote)
|
||||||
|
@ -200,9 +200,9 @@ func (sv *XTCPVisitor) handleConn(userConn net.Conn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if sv.cfg.UseCompression {
|
if sv.cfg.UseCompression {
|
||||||
var releaseFn func()
|
var recycleFn func()
|
||||||
muxConnRWCloser, releaseFn = libio.WithCompressionFromPool(muxConnRWCloser)
|
muxConnRWCloser, recycleFn = libio.WithCompressionFromPool(muxConnRWCloser)
|
||||||
defer releaseFn()
|
defer recycleFn()
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _, errs := libio.Join(userConn, muxConnRWCloser)
|
_, _, errs := libio.Join(userConn, muxConnRWCloser)
|
||||||
|
2
go.mod
2
go.mod
@ -6,7 +6,7 @@ require (
|
|||||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
|
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
|
||||||
github.com/coreos/go-oidc/v3 v3.6.0
|
github.com/coreos/go-oidc/v3 v3.6.0
|
||||||
github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb
|
github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb
|
||||||
github.com/fatedier/golib v0.1.1-0.20230720124328-204db2e322f8
|
github.com/fatedier/golib v0.1.1-0.20230725122706-dcbaee8eef40
|
||||||
github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible
|
github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible
|
||||||
github.com/go-playground/validator/v10 v10.14.1
|
github.com/go-playground/validator/v10 v10.14.1
|
||||||
github.com/google/uuid v1.3.0
|
github.com/google/uuid v1.3.0
|
||||||
|
4
go.sum
4
go.sum
@ -26,8 +26,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
|
|||||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||||
github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb h1:wCrNShQidLmvVWn/0PikGmpdP0vtQmnvyRg3ZBEhczw=
|
github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb h1:wCrNShQidLmvVWn/0PikGmpdP0vtQmnvyRg3ZBEhczw=
|
||||||
github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb/go.mod h1:wx3gB6dbIfBRcucp94PI9Bt3I0F2c/MyNEWuhzpWiwk=
|
github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb/go.mod h1:wx3gB6dbIfBRcucp94PI9Bt3I0F2c/MyNEWuhzpWiwk=
|
||||||
github.com/fatedier/golib v0.1.1-0.20230720124328-204db2e322f8 h1:8JYzwZ26k1zEsjgits6GHsQxm2tl3K3FYgMMLcIKBKU=
|
github.com/fatedier/golib v0.1.1-0.20230725122706-dcbaee8eef40 h1:BVdpWT6viE/mpuRa6txNyRNjtHa1Efrii9Du6/gHfJ0=
|
||||||
github.com/fatedier/golib v0.1.1-0.20230720124328-204db2e322f8/go.mod h1:Lmi9U4VfvdRvonSMh1FgXVy1hCXycVyJk4E9ktokknE=
|
github.com/fatedier/golib v0.1.1-0.20230725122706-dcbaee8eef40/go.mod h1:Lmi9U4VfvdRvonSMh1FgXVy1hCXycVyJk4E9ktokknE=
|
||||||
github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible h1:ssXat9YXFvigNge/IkkZvFMn8yeYKFX+uI6wn2mLJ74=
|
github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible h1:ssXat9YXFvigNge/IkkZvFMn8yeYKFX+uI6wn2mLJ74=
|
||||||
github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible/go.mod h1:YpCOaxj7vvMThhIQ9AfTOPW2sfztQR5WDfs7AflSy4s=
|
github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible/go.mod h1:YpCOaxj7vvMThhIQ9AfTOPW2sfztQR5WDfs7AflSy4s=
|
||||||
github.com/fatedier/yamux v0.0.0-20230628132301-7aca4898904d h1:ynk1ra0RUqDWQfvFi5KtMiSobkVQ3cNc0ODb8CfIETo=
|
github.com/fatedier/yamux v0.0.0-20230628132301-7aca4898904d h1:ynk1ra0RUqDWQfvFi5KtMiSobkVQ3cNc0ODb8CfIETo=
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version = "0.51.1"
|
var version = "0.51.2"
|
||||||
|
|
||||||
func Full() string {
|
func Full() string {
|
||||||
return version
|
return version
|
||||||
|
@ -175,9 +175,7 @@ func (pxy *HTTPProxy) GetRealConn(remoteAddr string) (workConn net.Conn, err err
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if pxy.cfg.UseCompression {
|
if pxy.cfg.UseCompression {
|
||||||
var releaseFn func()
|
rwc = libio.WithCompression(rwc)
|
||||||
rwc, releaseFn = libio.WithCompressionFromPool(rwc)
|
|
||||||
defer releaseFn()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if pxy.GetLimiter() != nil {
|
if pxy.GetLimiter() != nil {
|
||||||
|
@ -241,9 +241,9 @@ func (pxy *BaseProxy) handleUserTCPConnection(userConn net.Conn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if cfg.UseCompression {
|
if cfg.UseCompression {
|
||||||
var releaseFn func()
|
var recycleFn func()
|
||||||
local, releaseFn = libio.WithCompressionFromPool(local)
|
local, recycleFn = libio.WithCompressionFromPool(local)
|
||||||
defer releaseFn()
|
defer recycleFn()
|
||||||
}
|
}
|
||||||
|
|
||||||
if pxy.GetLimiter() != nil {
|
if pxy.GetLimiter() != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user