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:
1 parent
ccbe364f9f
commit
f66abe5fcb
1 file changed
+6
@@ -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