wuxibin89 / redis-go-cluster

redis cluster client implementation in Go
Apache License 2.0
488 stars 145 forks source link

Use domain name to init the client will panic #8

Open deamonwatcher opened 8 years ago

deamonwatcher commented 8 years ago

if i use domain name to init the client instead of ip address, like this: cluster, err := redis.NewCluster( &redis.Options{ StartNodes: []string{"1xxx.com:7000", "2xxx.com:7001", "3xxx.com:7002"}, ConnTimeout: 50 * time.Millisecond, ReadTimeout: 50 * time.Millisecond, WriteTimeout: 50 * time.Millisecond, KeepAlive: 16, AliveTime: 60 * time.Second, })

it will be panic when my application running, i find out the problem in this file:node.go. if conn.c.RemoteAddr().String() != node.address { panic("unreachable") }

the result of "conn.c.RemoteAddr().String()" is ip address, but the return of node.address is domain name

wuxibin89 commented 8 years ago

Yes, it's really a bug. Maybe there's no need to check ip when release connection, I will first remove the check. If you have any problem, please let me know.

Thanks