Fix pickRandConn bad loop

This commit is contained in:
Andy Wang 2020-01-22 22:17:18 +00:00
parent 3f5fdae284
commit 99fa812594

View File

@ -113,8 +113,8 @@ func (sb *switchboard) pickRandConn() (uint32, net.Conn, error) {
var id uint32 var id uint32
var conn net.Conn var conn net.Conn
r := rand.Intn(connCount) r := rand.Intn(connCount)
sb.conns.Range(func(connIdI, connI interface{}) bool {
var c int var c int
sb.conns.Range(func(connIdI, connI interface{}) bool {
if r == c { if r == c {
id = connIdI.(uint32) id = connIdI.(uint32)
conn = connI.(net.Conn) conn = connI.(net.Conn)