Skip to content

Commit 684adf9

Browse files
committed
fixup! ws_js: Update to match new close code
1 parent a9e9d67 commit 684adf9

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

read.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ func (c *Conn) Read(ctx context.Context) (MessageType, []byte, error) {
6464
// This function is idempotent.
6565
func (c *Conn) CloseRead(ctx context.Context) context.Context {
6666
c.closeReadMu.Lock()
67-
if c.closeReadCtx != nil {
67+
ctx := c.closeReadCtx
68+
if ctx != nil {
6869
c.closeReadMu.Unlock()
69-
return c.closeReadCtx
70+
return ctx
7071
}
7172
ctx, cancel := context.WithCancel(ctx)
7273
c.closeReadCtx = ctx

ws_js.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,10 @@ func (w *writer) Close() error {
392392
// CloseRead implements *Conn.CloseRead for wasm.
393393
func (c *Conn) CloseRead(ctx context.Context) context.Context {
394394
c.closeReadMu.Lock()
395-
if c.closeReadCtx != nil {
395+
ctx := c.closeReadCtx
396+
if ctx != nil {
396397
c.closeReadMu.Unlock()
397-
return c.closeReadCtx
398+
return ctx
398399
}
399400
ctx, cancel := context.WithCancel(ctx)
400401
c.closeReadCtx = ctx

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy