Skip to content

Commit

Permalink
Fix goroutine leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Alpha2J committed Jan 15, 2025
1 parent 881f214 commit 751c789
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions server/proxy/xtcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (
"reflect"
"sync"

"github.com/fatedier/golib/errors"

v1 "github.com/fatedier/frp/pkg/config/v1"
"github.com/fatedier/frp/pkg/msg"
)
Expand Down Expand Up @@ -90,11 +88,9 @@ func (pxy *XTCPProxy) Run() (remoteAddr string, err error) {
}

func (pxy *XTCPProxy) Close() {
pxy.BaseProxy.Close()
pxy.rc.NatHoleController.CloseClient(pxy.GetName())
pxy.closeOnce.Do(func() {
_ = errors.PanicToError(func() {
close(pxy.closeCh)
})
pxy.BaseProxy.Close()
pxy.rc.NatHoleController.CloseClient(pxy.GetName())
close(pxy.closeCh)
})
}

0 comments on commit 751c789

Please sign in to comment.