Skip to content

Commit

Permalink
ws_js_test: Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nhooyr committed Apr 7, 2024
1 parent 5d45a30 commit 7c5b012
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
4 changes: 0 additions & 4 deletions close.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,6 @@ func (c *Conn) waitCloseHandshake() error {
}
defer c.readMu.unlock()

if c.readCloseFrameErr != nil {
return c.readCloseFrameErr
}

for i := int64(0); i < c.msgReader.payloadLength; i++ {
_, err := c.br.ReadByte()
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ type Conn struct {
readHeaderBuf [8]byte
readControlBuf [maxControlPayload]byte
msgReader *msgReader
readCloseFrameErr error

// Write state.
msgWriter *msgWriter
Expand Down
2 changes: 1 addition & 1 deletion conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func TestWasm(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()

cmd := exec.CommandContext(ctx, "go", "test", "-exec=wasmbrowsertest", ".")
cmd := exec.CommandContext(ctx, "go", "test", "-exec=wasmbrowsertest", ".", "-v")
cmd.Env = append(os.Environ(), "GOOS=js", "GOARCH=wasm", fmt.Sprintf("WS_ECHO_SERVER_URL=%v", s.URL))

b, err := cmd.CombinedOutput()
Expand Down
6 changes: 3 additions & 3 deletions read.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,7 @@ func (c *Conn) handleControl(ctx context.Context, h header) (err error) {
return nil
}

defer func() {
c.readCloseFrameErr = err
}()
// opClose

ce, err := parseClosePayload(b)
if err != nil {
Expand All @@ -326,6 +324,8 @@ func (c *Conn) handleControl(ctx context.Context, h header) (err error) {

err = fmt.Errorf("received close frame: %w", ce)
c.writeClose(ce.Code, ce.Reason)
c.readMu.unlock()
c.close()
return err
}

Expand Down

0 comments on commit 7c5b012

Please sign in to comment.