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