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:
TrickIt
2021-05-31 15:26:26 +08:00
committed by GitHub
parent ccbe364f9f
commit f66abe5fcb

View File

@@ -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,