mirror of
https://github.com/fatedier/frp.git
synced 2025-08-02 12:07:20 +00:00
Compare commits
2 Commits
v0.53.0
...
3540910879
Author | SHA1 | Date | |
---|---|---|---|
|
3540910879 | ||
|
2d67e2e0c6 |
5
.github/pull_request_template.md
vendored
5
.github/pull_request_template.md
vendored
@@ -1,6 +1,3 @@
|
||||
### Summary
|
||||
|
||||
copilot:summary
|
||||
|
||||
### WHY
|
||||
|
||||
<!-- author to complete -->
|
||||
|
@@ -16,10 +16,9 @@ package wait
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/samber/lo"
|
||||
|
||||
"github.com/fatedier/frp/pkg/util/util"
|
||||
)
|
||||
|
||||
@@ -182,16 +181,18 @@ func Until(f func(), period time.Duration, stopCh <-chan struct{}) {
|
||||
|
||||
func MergeAndCloseOnAnyStopChannel[T any](upstreams ...<-chan T) <-chan T {
|
||||
out := make(chan T)
|
||||
|
||||
closeOnce := sync.Once{}
|
||||
for _, upstream := range upstreams {
|
||||
ch := upstream
|
||||
go lo.Try0(func() {
|
||||
go func() {
|
||||
select {
|
||||
case <-ch:
|
||||
close(out)
|
||||
closeOnce.Do(func() {
|
||||
close(out)
|
||||
})
|
||||
case <-out:
|
||||
}
|
||||
})
|
||||
}()
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
Reference in New Issue
Block a user