10000 fix: avoid writing messages after close and improve handshake by FrauElster · Pull Request #476 · coder/websocket · GitHub
[go: up one dir, main page]

Skip to content

fix: avoid writing messages after close and improve handshake #476

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

Merged
merged 12 commits into from
Dec 4, 2024
Prev Previous commit
Next Next commit
move disconnected comment
  • Loading branch information
mafredri committed Nov 29, 2024
commit e8f5b511297d15bc12eb3252b83bce1d7963c9cf
4 changes: 2 additions & 2 deletions conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ func (tt *connTest) goDiscardLoop(c *websocket.Conn) {
}

func BenchmarkConn(b *testing.B) {
var benchCases = []struct {
benchCases := []struct {
name string
mode websocket.CompressionMode
}{
Expand Down Expand Up @@ -655,6 +655,7 @@ func TestConnClosePropagation(t *testing.T) {
})
}
checkReadErr := func(t *testing.T, err error) {
// Check read error (output depends on when read is called in relation to connection closure).
var ce websocket.CloseError
if errors.As(err, &ce) {
assert.Equal(t, "", websocket.StatusNormalClosure, ce.Code)
Expand All @@ -668,7 +669,6 @@ func TestConnClosePropagation(t *testing.T) {
err := c.Write(context.Background(), websocket.MessageText, want)
assert.ErrorIs(t, net.ErrClosed, err)

// Check read error (output depends on when read is called in relation to connection closure).
_, _, err = c.Read(context.Background())
checkReadErr(t, err)
}
Expand Down
0