1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-17 23:06:30 -05:00

simplify error propagation

This commit is contained in:
Darien Raymond 2017-04-17 19:33:22 +02:00
parent bf64c449de
commit 54b441d690
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -32,13 +32,13 @@ func ErrorOrFinish2(ctx context.Context, c1, c2 <-chan error) error {
select {
case <-ctx.Done():
return ctx.Err()
case err, failed := <-c1:
if failed {
case err := <-c1:
if err != nil {
return err
}
return ErrorOrFinish1(ctx, c2)
case err, failed := <-c2:
if failed {
case err := <-c2:
if err != nil {
return err
}
return ErrorOrFinish1(ctx, c1)