mirror of
https://github.com/fhmq/hmq.git
synced 2026-08-31 23:04:52 +00:00
add fix pool for message order (#42)
* fix pool for message order * add go modules
This commit is contained in:
+5
-2
@@ -104,7 +104,7 @@ func NewBroker(config *Config) (*Broker, error) {
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (b *Broker) SubmitWork(msg *Message) {
|
||||
func (b *Broker) SubmitWork(clientId string, msg *Message) {
|
||||
if b.wpool == nil {
|
||||
b.wpool = pool.New(b.config.Worker)
|
||||
}
|
||||
@@ -112,7 +112,7 @@ func (b *Broker) SubmitWork(msg *Message) {
|
||||
if msg.client.typ == CLUSTER {
|
||||
b.clusterPool <- msg
|
||||
} else {
|
||||
b.wpool.Submit(func() {
|
||||
b.wpool.Submit(clientId, func() {
|
||||
ProcessMessage(msg)
|
||||
})
|
||||
}
|
||||
@@ -322,6 +322,9 @@ func (b *Broker) handleConnection(typ int, conn net.Conn) {
|
||||
log.Error("received msg that was not Connect")
|
||||
return
|
||||
}
|
||||
|
||||
log.Info("reconnect connect from ", zap.String("clientID", msg.ClientIdentifier))
|
||||
|
||||
connack := packets.NewControlPacket(packets.Connack).(*packets.ConnackPacket)
|
||||
connack.ReturnCode = packets.Accepted
|
||||
connack.SessionPresent = msg.CleanSession
|
||||
|
||||
Reference in New Issue
Block a user