Fix goroutine leaks

This commit is contained in:
Jeb.Wang 2025-01-15 22:32:48 +08:00
parent 881f21431d
commit 751c789cca

View File

@ -19,8 +19,6 @@ import (
"reflect" "reflect"
"sync" "sync"
"github.com/fatedier/golib/errors"
v1 "github.com/fatedier/frp/pkg/config/v1" v1 "github.com/fatedier/frp/pkg/config/v1"
"github.com/fatedier/frp/pkg/msg" "github.com/fatedier/frp/pkg/msg"
) )
@ -90,11 +88,9 @@ func (pxy *XTCPProxy) Run() (remoteAddr string, err error) {
} }
func (pxy *XTCPProxy) Close() { func (pxy *XTCPProxy) Close() {
pxy.BaseProxy.Close()
pxy.rc.NatHoleController.CloseClient(pxy.GetName())
pxy.closeOnce.Do(func() { pxy.closeOnce.Do(func() {
_ = errors.PanicToError(func() { pxy.BaseProxy.Close()
close(pxy.closeCh) pxy.rc.NatHoleController.CloseClient(pxy.GetName())
}) close(pxy.closeCh)
}) })
} }