mirror of
https://github.com/golang/go
synced 2024-11-24 10:40:10 -07:00
net: simplify code
Single-case select with a non-nil channel is pointless. LGTM=mikioh.mikioh R=mikioh.mikioh CC=golang-codereviews https://golang.org/cl/103920044
This commit is contained in:
parent
cc81712190
commit
5ce98da1a2
@ -214,14 +214,12 @@ func dialMulti(net, addr string, la Addr, ras addrList, deadline time.Time) (Con
|
|||||||
nracers := len(ras)
|
nracers := len(ras)
|
||||||
for nracers > 0 {
|
for nracers > 0 {
|
||||||
sig <- true
|
sig <- true
|
||||||
select {
|
racer := <-lane
|
||||||
case racer := <-lane:
|
if racer.error == nil {
|
||||||
if racer.error == nil {
|
return racer.Conn, nil
|
||||||
return racer.Conn, nil
|
|
||||||
}
|
|
||||||
lastErr = racer.error
|
|
||||||
nracers--
|
|
||||||
}
|
}
|
||||||
|
lastErr = racer.error
|
||||||
|
nracers--
|
||||||
}
|
}
|
||||||
return nil, lastErr
|
return nil, lastErr
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user