Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conn.go: default close handler should not return ErrCloseSent. #865

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

pnx
Copy link
Contributor

@pnx pnx commented Nov 9, 2023

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Go Version Update
  • Dependency Update

Description

Noticed a change in default close handler from 1.5.0 to 1.5.1

1.5.1 Now returns the error from WriteControl with CloseMessage type. However this results in ErrCloseSent returned if the connection initiated the close handshake. This is normally correct as the connection should not be able to write after a close handshake is initiated, except when calling the close handler. in that case nil should be returned so that advanceFrame() can return the actual close message.

Related Tickets & Documents

Added/updated tests?

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

Run verifications and test

  • make verify is passing (fails with GO-2023-2186 Incorrect detection of reserved device names on Windows in path/filepath that is unrelated to this change)
  • make test is passing

@pnx
Copy link
Contributor Author

pnx commented Nov 12, 2023

@coreydaley can you take a look at this?

Copy link

codecov bot commented Nov 13, 2023

Codecov Report

Merging #865 (07089bb) into main (629990d) will increase coverage by 0.20%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##             main     #865      +/-   ##
==========================================
+ Coverage   69.99%   70.20%   +0.20%     
==========================================
  Files          11       11              
  Lines        1593     1594       +1     
==========================================
+ Hits         1115     1119       +4     
+ Misses        364      362       -2     
+ Partials      114      113       -1     
Files Coverage Δ
conn.go 65.47% <50.00%> (+0.46%) ⬆️

@coreydaley coreydaley self-requested a review November 13, 2023 00:46
@coreydaley coreydaley merged commit 6f5d213 into gorilla:main Nov 13, 2023
10 of 13 checks passed
@ghost ghost mentioned this pull request Dec 11, 2023
1 task
algitbot pushed a commit to alpinelinux/build-server-status that referenced this pull request Sep 15, 2024
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/gorilla/websocket](https://github.com/gorilla/websocket) | require | patch | `v1.5.1` -> `v1.5.3` |

---

### Release Notes

<details>
<summary>gorilla/websocket (github.com/gorilla/websocket)</summary>

### [`v1.5.3`](https://github.com/gorilla/websocket/releases/tag/v1.5.3)

[Compare Source](gorilla/websocket@v1.5.2...v1.5.3)

#### Important change

This reverts the websockets package back to gorilla/websocket@931041c

#### What's Changed

-   Fixes subprotocol selection (aling with rfc6455) by [@&#8203;KSDaemon](https://github.com/KSDaemon) in gorilla/websocket#823
-   Update README.md, replace master to main by [@&#8203;mstmdev](https://github.com/mstmdev) in gorilla/websocket#862
-   Use status code constant by [@&#8203;mstmdev](https://github.com/mstmdev) in gorilla/websocket#864
-   conn.go: default close handler should not return ErrCloseSent. by [@&#8203;pnx](https://github.com/pnx) in gorilla/websocket#865
-   fix: replace ioutil.readfile with os.readfile by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#868
-   fix: add comment for the readBufferSize and writeBufferSize by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#869
-   Remove noisy printf in NextReader() and beginMessage() by [@&#8203;bcreane](https://github.com/bcreane) in gorilla/websocket#878
-   docs(echoreadall): fix function echoReadAll comment by [@&#8203;XdpCs](https://github.com/XdpCs) in gorilla/websocket#881
-   make tests parallel by [@&#8203;ninedraft](https://github.com/ninedraft) in gorilla/websocket#872
-   Upgrader.Upgrade: use http.ResposnseController by [@&#8203;ninedraft](https://github.com/ninedraft) in gorilla/websocket#871
-   Do not handle network error in `SetCloseHandler()` by [@&#8203;nak3](https://github.com/nak3) in gorilla/websocket#863
-   perf: reduce timer in write_control by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#879
-   fix: lint example code by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#890
-   feat: format message type by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#889
-   Remove hideTempErr to allow downstream users to check for errors like net.ErrClosed by [@&#8203;UnAfraid](https://github.com/UnAfraid) in gorilla/websocket#894
-   Do not timeout when WriteControl deadline is zero in gorilla/websocket#898
-   Excludes errchecks linter by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#904
-   Return errors instead of printing to logs by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#897
-   Revert " Update go version & add verification/testing tools ([#&#8203;840](gorilla/websocket#840))" by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#908
-   Fixes broken random value generation by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#926
-   Reverts back to v1.5.0 by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#929

#### New Contributors

-   [@&#8203;KSDaemon](https://github.com/KSDaemon) made their first contribution in gorilla/websocket#823
-   [@&#8203;mstmdev](https://github.com/mstmdev) made their first contribution in gorilla/websocket#862
-   [@&#8203;pnx](https://github.com/pnx) made their first contribution in gorilla/websocket#865
-   [@&#8203;rfyiamcool](https://github.com/rfyiamcool) made their first contribution in gorilla/websocket#868
-   [@&#8203;bcreane](https://github.com/bcreane) made their first contribution in gorilla/websocket#878
-   [@&#8203;XdpCs](https://github.com/XdpCs) made their first contribution in gorilla/websocket#881
-   [@&#8203;ninedraft](https://github.com/ninedraft) made their first contribution in gorilla/websocket#872
-   [@&#8203;nak3](https://github.com/nak3) made their first contribution in gorilla/websocket#863
-   [@&#8203;UnAfraid](https://github.com/UnAfraid) made their first contribution in gorilla/websocket#894
-   [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) made their first contribution in gorilla/websocket#904

**Full Changelog**: gorilla/websocket@v1.5.1...v1.5.3

### [`v1.5.2`](https://github.com/gorilla/websocket/releases/tag/v1.5.2)

[Compare Source](gorilla/websocket@v1.5.1...v1.5.2)

#### What's Changed

-   Fixes subprotocol selection (aling with rfc6455) by [@&#8203;KSDaemon](https://github.com/KSDaemon) in gorilla/websocket#823
-   Update README.md, replace master to main by [@&#8203;mstmdev](https://github.com/mstmdev) in gorilla/websocket#862
-   Use status code constant by [@&#8203;mstmdev](https://github.com/mstmdev) in gorilla/websocket#864
-   conn.go: default close handler should not return ErrCloseSent. by [@&#8203;pnx](https://github.com/pnx) in gorilla/websocket#865
-   fix: replace ioutil.readfile with os.readfile by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#868
-   fix: add comment for the readBufferSize and writeBufferSize by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#869
-   Remove noisy printf in NextReader() and beginMessage() by [@&#8203;bcreane](https://github.com/bcreane) in gorilla/websocket#878
-   docs(echoreadall): fix function echoReadAll comment by [@&#8203;XdpCs](https://github.com/XdpCs) in gorilla/websocket#881
-   make tests parallel by [@&#8203;ninedraft](https://github.com/ninedraft) in gorilla/websocket#872
-   Upgrader.Upgrade: use http.ResposnseController by [@&#8203;ninedraft](https://github.com/ninedraft) in gorilla/websocket#871
-   Do not handle network error in `SetCloseHandler()` by [@&#8203;nak3](https://github.com/nak3) in gorilla/websocket#863
-   perf: reduce timer in write_control by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#879
-   fix: lint example code by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#890
-   feat: format message type by [@&#8203;rfyiamcool](https://github.com/rfyiamcool) in gorilla/websocket#889
-   Remove hideTempErr to allow downstream users to check for errors like net.ErrClosed by [@&#8203;UnAfraid](https://github.com/UnAfraid) in gorilla/websocket#894
-   Do not timeout when WriteControl deadline is zero in gorilla/websocket#898
-   Excludes errchecks linter by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#904
-   Return errors instead of printing to logs by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#897
-   Revert " Update go version & add verification/testing tools ([#&#8203;840](gorilla/websocket#840))" by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#908
-   Fixes broken random value generation by [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) in gorilla/websocket#926

#### New Contributors

-   [@&#8203;KSDaemon](https://github.com/KSDaemon) made their first contribution in gorilla/websocket#823
-   [@&#8203;mstmdev](https://github.com/mstmdev) made their first contribution in gorilla/websocket#862
-   [@&#8203;pnx](https://github.com/pnx) made their first contribution in gorilla/websocket#865
-   [@&#8203;rfyiamcool](https://github.com/rfyiamcool) made their first contribution in gorilla/websocket#868
-   [@&#8203;bcreane](https://github.com/bcreane) made their first contribution in gorilla/websocket#878
-   [@&#8203;XdpCs](https://github.com/XdpCs) made their first contribution in gorilla/websocket#881
-   [@&#8203;ninedraft](https://github.com/ninedraft) made their first contribution in gorilla/websocket#872
-   [@&#8203;nak3](https://github.com/nak3) made their first contribution in gorilla/websocket#863
-   [@&#8203;UnAfraid](https://github.com/UnAfraid) made their first contribution in gorilla/websocket#894
-   [@&#8203;apoorvajagtap](https://github.com/apoorvajagtap) made their first contribution in gorilla/websocket#904

**Full Changelog**: gorilla/websocket@v1.5.1...v1.5.2

</details>

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

&nbsp;
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yODYuMSIsInVwZGF0ZWRJblZlciI6IjM3LjQxOS4xIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->

See merge request alpine/infra/build-server-status!14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants