diff --git a/websocket.go b/websocket.go index 6480aed66ff1b1b8c39da1cf034b4d29df8fa101..db2e82e70c78f9347f64e33ec967210727d3d800 100644 --- a/websocket.go +++ b/websocket.go @@ -201,7 +201,7 @@ func (c *Conn) timeoutLoop() { parentCtx := context.Background() cancelCtx := func() {} defer func() { - // We do not defer cancelCtx because its value can change. + // We do not defer cancelCtx directly because its value may change. cancelCtx() }() @@ -224,9 +224,6 @@ func (c *Conn) timeoutLoop() { select { case <-c.closed: return - case <-parentCtx.Done(): - c.close(xerrors.Errorf("parent context cancelled: %w", parentCtx.Err())) - return case c.getConnContext <- ctx: } }