Skip to content

Commit 8b47056

Browse files
committed
Pass through close errors
1 parent 780bda4 commit 8b47056

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

conn.go

+4
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ func (c *Conn) readTillMsg(ctx context.Context) (header, error) {
236236
if h.opcode.controlOp() {
237237
err = c.handleControl(ctx, h)
238238
if err != nil {
239+
// Pass through CloseErrors when receiving a close frame.
240+
if h.opcode == opClose && CloseStatus(err) != -1 {
241+
return header{}, err
242+
}
239243
return header{}, fmt.Errorf("failed to handle control frame %v: %w", h.opcode, err)
240244
}
241245
continue

0 commit comments

Comments
 (0)