Merge pull request #417 from unistack-org/gossip

registry: [gossip] fix panic
This commit is contained in:
Asim Aslam 2019-02-13 13:41:28 +00:00 committed by GitHub
commit c3722877c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -561,11 +561,13 @@ func (g *gossipRegistry) run() {
case <-ticker.C: case <-ticker.C:
var addrs []string var addrs []string
g.RLock() g.RLock()
if g.member != nil {
for node, action := range g.members { for node, action := range g.members {
if action == nodeActionLeave && g.member.LocalNode().Address() != node { if action == nodeActionLeave && g.member.LocalNode().Address() != node {
addrs = append(addrs, node) addrs = append(addrs, node)
} }
} }
}
g.RUnlock() g.RUnlock()
if len(addrs) > 0 { if len(addrs) > 0 {
g.connect(addrs) g.connect(addrs)