mirror of
https://github.com/fhmq/hmq.git
synced 2026-05-04 07:08:32 +00:00
fix: if packet is disconnect from client, then need to break the read packet loop before next loop start, and clear will msg. (#120)
This commit is contained in:
@@ -180,6 +180,12 @@ func (c *client) readLoop() {
|
||||
return
|
||||
}
|
||||
|
||||
// if packet is disconnect from client, then need to break the read packet loop and clear will msg.
|
||||
if _, isDisconnect := packet.(*packets.DisconnectPacket); isDisconnect {
|
||||
c.info.willMsg = nil
|
||||
c.cancelFunc()
|
||||
}
|
||||
|
||||
msg := &Message{
|
||||
client: c,
|
||||
packet: packet,
|
||||
|
||||
Reference in New Issue
Block a user