This commit is contained in:
zhouyuyan
2017-08-23 21:10:38 +08:00
parent 922a10fd66
commit e73776d670
6 changed files with 101 additions and 56 deletions

View File

@@ -73,14 +73,17 @@ func (b *Broker) handleConnection(conn net.Conn, idx int) {
keepalive: connMsg.KeepAlive(),
willMsg: willmsg,
}
pool := MSGPool[idx%MessagePoolNum].GetPool()
c := &client{
broker: b,
conn: conn,
info: info,
msgPool: pool,
broker: b,
conn: conn,
info: info,
}
c.init()
c.readLoop()
pool.Reduce()
c.woker = Worker{
WorkerPool: MyDispatcher,
MsgChannel: make(chan *Message),
quit: make(chan bool),
}
c.readLoop(idx)
}