diff --git a/pkg/object/mqttproxy/broker.go b/pkg/object/mqttproxy/broker.go index 26b129b40b..a8f0110df4 100644 --- a/pkg/object/mqttproxy/broker.go +++ b/pkg/object/mqttproxy/broker.go @@ -366,9 +366,9 @@ func (b *Broker) handleConn(conn net.Conn) { } } b.clients[client.info.cid] = client - b.setSession(client, connect) b.Unlock() + b.setSession(client, connect) err = connack.Write(conn) if err != nil { logger.SpanErrorf(nil, "send connack to client %s failed: %s", connect.ClientIdentifier, err)