skip self

This commit is contained in:
zhouyuyan
2018-01-19 13:53:47 +08:00
parent 7462afcfb5
commit dc0f2185ab
2 changed files with 5 additions and 4 deletions

View File

@@ -450,6 +450,10 @@ func (b *Broker) connectRouter(id, addr string) {
}
func (b *Broker) checkNodeExist(id, url string) bool {
if id == b.id {
return false
}
for k, v := range b.nodes {
if k == id {
return true

View File

@@ -522,10 +522,7 @@ func (c *client) Close() {
//do reconnect
if c.typ == REMOTE {
localUrl := c.info.localIP + ":" + c.broker.config.Cluster.Port
if c.route.remoteUrl != localUrl {
go b.connectRouter(c.route.remoteID, c.route.remoteUrl)
}
go b.connectRouter(c.route.remoteID, c.route.remoteUrl)
}
}
}