Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2604
I have:
c.close(websocket.CloseAbnormalClosure, "unexpected closure")
sincec.close()
is also triggered viago c.closeOnCancel(ctx)
on line 281. This seems to have fixed the dual firing of a supplied closefunction for me, where the exit of the for loop on line 291 would fire the close function twice (via the defer directly, but also viago c.closeOnCancel(ctx)
indirectly triggered by the defer). I will however point to line 305 and line 317, where the loop is also exited with explicit closures. I have not run into those lines in the debugger, but i would actually have expected those places to firec.close()
three times before, and now instead two times (probably still too many).Let me know if i can add this expected behavior to existing tests.