feat: replace Try0 to std

This commit is contained in:
wuqinqiang 2023-12-21 11:30:32 +08:00
parent 8adf35d480
commit 61438cb955

View File

@ -19,8 +19,6 @@ import (
"sync" "sync"
"time" "time"
"github.com/samber/lo"
"github.com/fatedier/frp/pkg/util/util" "github.com/fatedier/frp/pkg/util/util"
) )
@ -186,7 +184,7 @@ func MergeAndCloseOnAnyStopChannel[T any](upstreams ...<-chan T) <-chan T {
closeOnce := sync.Once{} closeOnce := sync.Once{}
for _, upstream := range upstreams { for _, upstream := range upstreams {
ch := upstream ch := upstream
go lo.Try0(func() { go func() {
select { select {
case <-ch: case <-ch:
closeOnce.Do(func() { closeOnce.Do(func() {
@ -194,7 +192,7 @@ func MergeAndCloseOnAnyStopChannel[T any](upstreams ...<-chan T) <-chan T {
}) })
case <-out: case <-out:
} }
}) }()
} }
return out return out
} }