mirror of
https://github.com/fhmq/hmq.git
synced 2026-08-30 14:24:53 +00:00
Add addr in broekr log (#146)
This commit is contained in:
+3
-2
@@ -283,7 +283,7 @@ func (b *Broker) handleConnection(typ int, conn net.Conn) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("read connect from ", zap.String("clientID", msg.ClientIdentifier))
|
log.Info("read connect from ", zap.String("clientID", msg.ClientIdentifier), zap.String("addr", conn.RemoteAddr().String()))
|
||||||
|
|
||||||
connack := packets.NewControlPacket(packets.Connack).(*packets.ConnackPacket)
|
connack := packets.NewControlPacket(packets.Connack).(*packets.ConnackPacket)
|
||||||
connack.SessionPresent = msg.CleanSession
|
connack.SessionPresent = msg.CleanSession
|
||||||
@@ -360,7 +360,8 @@ func (b *Broker) handleConnection(typ int, conn net.Conn) {
|
|||||||
case CLIENT:
|
case CLIENT:
|
||||||
old, exist = b.clients.Load(cid)
|
old, exist = b.clients.Load(cid)
|
||||||
if exist {
|
if exist {
|
||||||
log.Warn("client exist, close old...", zap.String("clientID", c.info.clientID))
|
log.Warn("client exist, close old...", zap.String("clientID", c.info.clientID),
|
||||||
|
zap.String("addr", conn.RemoteAddr().String()))
|
||||||
ol, ok := old.(*client)
|
ol, ok := old.(*client)
|
||||||
if ok {
|
if ok {
|
||||||
ol.Close()
|
ol.Close()
|
||||||
|
|||||||
Reference in New Issue
Block a user