cluster fix

This commit is contained in:
zhouyuyan
2018-01-17 09:39:07 +08:00
parent 1d6f6a4a71
commit 7db7edaa17
3 changed files with 9 additions and 14 deletions

View File

@@ -288,17 +288,11 @@ func (b *Broker) handleConnection(typ int, conn net.Conn, idx uint64) {
conn: conn,
info: info,
}
c.init()
cid := c.info.clientID
if typ == ROUTER {
c.route = route{
remoteID: "",
remoteUrl: conn.RemoteAddr().String(),
}
}
var msgPool *MessagePool
var exist bool
var old interface{}
@@ -358,7 +352,7 @@ func (b *Broker) connectRouter(url, remoteID string) {
}
break
}
route := &route{
route := route{
remoteID: remoteID,
remoteUrl: conn.RemoteAddr().String(),
}

View File

@@ -32,7 +32,7 @@ type client struct {
broker *Broker
conn net.Conn
info info
route *route
route route
status int
closed chan int
smu sync.RWMutex

View File

@@ -110,13 +110,14 @@ func (c *client) ProcessInfo(packet *packets.PublishPacket) {
}
b.mu.Unlock()
// log.Info("isforword: ", isForward)
if !isForward {
route := &route{
remoteUrl: rurl,
remoteID: rid,
if c.typ == ROUTER {
route := route{
remoteUrl: rurl,
remoteID: rid,
}
c.route = route
}
c.route = route
go b.SendLocalSubsToRouter(c)
// log.Info("BroadcastInfoMessage starting... ")