mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-20 07:21:26 +02:00
refactor(concurrency): replaced manual WaitGroup management with new wg.Go() and removed redundant code.
This commit is contained in:
@@ -92,16 +92,15 @@ func NewBidirectionalPipe(ctx context.Context, rw1 io.ReadWriteCloser, rw2 io.Re
|
||||
|
||||
func (p BidirectionalPipe) Start() error {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(2)
|
||||
var srcErr, dstErr error
|
||||
go func() {
|
||||
wg.Go(func() {
|
||||
srcErr = p.pSrcDst.Start()
|
||||
wg.Done()
|
||||
}()
|
||||
go func() {
|
||||
})
|
||||
wg.Go(func() {
|
||||
dstErr = p.pDstSrc.Start()
|
||||
wg.Done()
|
||||
}()
|
||||
})
|
||||
wg.Wait()
|
||||
return errors.Join(srcErr, dstErr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user