Skip to content

Commit 0c8afd9

Browse files
chore: unlock only the once after locking
1 parent 67220ee commit 0c8afd9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

write.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,12 @@ func (c *Conn) write(ctx context.Context, typ MessageType, p []byte) (int, error
105105
if err != nil {
106106
return 0, err
107107
}
108+
defer c.msgWriter.mu.unlock()
108109

109110
if !c.flate() || len(p) < c.flateThreshold {
110-
defer c.msgWriter.mu.unlock()
111111
return c.writeFrame(ctx, true, false, c.msgWriter.opcode, p)
112112
}
113113

114-
defer c.msgWriter.mu.unlock()
115114
return c.msgWriter.writeCompressedFrame(ctx, p)
116115
}
117116

0 commit comments

Comments
 (0)