From 47346b0f106b80e9009e150b83ff429c8f98f0e4 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 25 Nov 2023 08:14:45 +0100 Subject: [PATCH] conn: drop ErrClosed workaround for WebSocket The fix has been merged upstream. --- conn.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/conn.go b/conn.go index cb9ba72..f681b05 100644 --- a/conn.go +++ b/conn.go @@ -76,18 +76,8 @@ func (wic *websocketIRCConn) WriteMessage(msg *irc.Message) error { return wic.conn.Write(ctx, websocket.MessageText, b) } -func isErrWebSocketClosed(err error) bool { - return err != nil && strings.HasSuffix(err.Error(), "failed to close WebSocket: already wrote close") -} - func (wic *websocketIRCConn) Close() error { - err := wic.conn.Close(websocket.StatusNormalClosure, "") - // TODO: remove once this PR is merged: - // https://github.com/nhooyr/websocket/pull/303 - if isErrWebSocketClosed(err) { - return nil - } - return err + return wic.conn.Close(websocket.StatusNormalClosure, "") } func (wic *websocketIRCConn) SetReadDeadline(t time.Time) error {