重新规划网关与节点的交互协议,实现统一命令位的识别和处理

This commit is contained in:
2025-05-16 15:13:16 +08:00
parent d65fe4db6f
commit 8a6a4833d4
22 changed files with 609 additions and 373 deletions

View File

@@ -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
}