Skip to content

Commit

Permalink
cluster fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouyuyan committed Jan 17, 2018
1 parent 1d6f6a4 commit 7db7eda
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
10 changes: 2 additions & 8 deletions broker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -358,7 +352,7 @@ func (b *Broker) connectRouter(url, remoteID string) {
}
break
}
route := &route{
route := route{
remoteID: remoteID,
remoteUrl: conn.RemoteAddr().String(),
}
Expand Down
2 changes: 1 addition & 1 deletion broker/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions broker/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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... ")
Expand Down

0 comments on commit 7db7eda

Please sign in to comment.