Skip to content

Commit

Permalink
Do not return error in SetCloseHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
nak3 committed Dec 11, 2023
1 parent 614baeb commit 1265f14
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -1158,14 +1158,7 @@ func (c *Conn) SetCloseHandler(h func(code int, text string) error) {
if h == nil {
h = func(code int, text string) error {
message := FormatCloseMessage(code, "")
err := c.WriteControl(CloseMessage, message, time.Now().Add(writeWait))
if err != nil {
if _, ok := err.(net.Error); ok {
return nil
} else if err != ErrCloseSent {
return err
}
}
_ = c.WriteControl(CloseMessage, message, time.Now().Add(writeWait))
return nil
}
}
Expand Down

0 comments on commit 1265f14

Please sign in to comment.