1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-11-24 08:02:32 +02:00

avoid connecting to self

This commit is contained in:
Asim Aslam 2020-01-21 12:36:05 +00:00
parent a18e53f028
commit 9f7d374691

View File

@ -382,8 +382,23 @@ func (n *network) initNodes(startup bool) {
return
}
// strip self
var init []string
// our current address
advertised := n.server.Options().Advertise
for _, node := range nodes {
// skip self
if node == advertised {
continue
}
// add the node
init = append(init, node)
}
// initialize the tunnel
log.Tracef("Network initialising nodes %+v\n", nodes)
log.Tracef("Network initialising nodes %+v\n", init)
n.tunnel.Init(
tunnel.Nodes(nodes...),