重新规划网关与节点的交互协议,实现统一命令位的识别和处理
This commit is contained in:
@@ -39,15 +39,11 @@ func ChanConnAccept(ctx context.Context, ls net.Listener) chan net.Conn {
|
||||
return ch
|
||||
}
|
||||
|
||||
func ChanWgWait[T WaitGroup](ctx context.Context, wg T) chan struct{} {
|
||||
func WgWait[T WaitGroup](wg T) <-chan struct{} {
|
||||
ch := make(chan struct{})
|
||||
go func() {
|
||||
defer close(ch)
|
||||
wg.Wait()
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
case ch <- struct{}{}:
|
||||
}
|
||||
ch <- struct{}{}
|
||||
}()
|
||||
return ch
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user