mirror of
https://github.com/fhmq/hmq.git
synced 2026-05-04 07:08:32 +00:00
use defer to unlock in WriterPacket() (#107)
This commit is contained in:
@@ -761,9 +761,8 @@ func (c *client) WriterPacket(packet packets.ControlPacket) error {
|
||||
}
|
||||
|
||||
c.mu.Lock()
|
||||
err := packet.Write(c.conn)
|
||||
c.mu.Unlock()
|
||||
return err
|
||||
defer c.mu.Unlock()
|
||||
return packet.Write(c.conn)
|
||||
}
|
||||
|
||||
func (c *client) registerPublishPacketId(packetId uint16) error {
|
||||
|
||||
Reference in New Issue
Block a user