mirror of
https://github.com/fatedier/frp.git
synced 2025-04-23 12:11:25 +00:00
Merge 751c789cca6039f79a04a1b3a9e2e17fa795c7b3 into 27db6217ecda9236f5bc25c65824f1e723810751
This commit is contained in:
commit
8ad9ec3d34
@ -17,8 +17,7 @@ package proxy
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/fatedier/golib/errors"
|
||||
"sync"
|
||||
|
||||
v1 "github.com/fatedier/frp/pkg/config/v1"
|
||||
"github.com/fatedier/frp/pkg/msg"
|
||||
@ -33,6 +32,7 @@ type XTCPProxy struct {
|
||||
cfg *v1.XTCPProxyConfig
|
||||
|
||||
closeCh chan struct{}
|
||||
closeOnce sync.Once
|
||||
}
|
||||
|
||||
func NewXTCPProxy(baseProxy *BaseProxy) Proxy {
|
||||
@ -43,6 +43,7 @@ func NewXTCPProxy(baseProxy *BaseProxy) Proxy {
|
||||
return &XTCPProxy{
|
||||
BaseProxy: baseProxy,
|
||||
cfg: unwrapped,
|
||||
closeCh: make(chan struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,9 +88,9 @@ func (pxy *XTCPProxy) Run() (remoteAddr string, err error) {
|
||||
}
|
||||
|
||||
func (pxy *XTCPProxy) Close() {
|
||||
pxy.closeOnce.Do(func() {
|
||||
pxy.BaseProxy.Close()
|
||||
pxy.rc.NatHoleController.CloseClient(pxy.GetName())
|
||||
_ = errors.PanicToError(func() {
|
||||
close(pxy.closeCh)
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user