Commit 2ab33312 authored by harrylee's avatar harrylee

Merge branch 'master' of gitlab.33.cn:link33/sidecar

parents 2513b66d fd0f3d7c
Pipeline #8423 failed with stages
...@@ -134,13 +134,15 @@ func (p *PortMap) RandRouterPort() Port { ...@@ -134,13 +134,15 @@ func (p *PortMap) RandRouterPort() Port {
p.rw.RLock() p.rw.RLock()
defer p.rw.RUnlock() defer p.rw.RUnlock()
l := len(p.peerPort) l := len(p.peerPort)
i := rand.Intn(l) if l > 0 {
j := 0 i := rand.Intn(l)
for _, pt := range p.peerPort { j := 0
if i == j { for _, pt := range p.peerPort {
return pt if i == j {
return pt
}
j++
} }
j++
} }
return nil return nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment