Re: [PATCH spice-html5 1/4] spiceconn: Add function to test channel capabilities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tomáš,

On 09/07/2017 02:18 AM, Tomáš Bohdálek wrote:
> This will be used in other commits.
> ---
>  spiceconn.js | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/spiceconn.js b/spiceconn.js
> index 33e7388..78d5820 100644
> --- a/spiceconn.js
> +++ b/spiceconn.js
> @@ -243,6 +243,9 @@ SpiceConn.prototype =
>          else if (this.state == "link")
>          {
>              this.reply_link = new SpiceLinkReply(mb);
> +            this.common_caps = this.reply_link.common_caps;
> +            this.channel_caps = this.reply_link.channel_caps;
> +

Why make a copy of the caps, instead of just using the reply_link
directly in the function?

>               // FIXME - Screen the caps - require minihdr at least, right?
>              if (this.reply_link.error)
>              {
> @@ -495,6 +498,22 @@ SpiceConn.prototype =
>          var e = new Error("Connection timed out.");
>          this.report_error(e);
>      },
> +
> +    test_capability: function(caps, cap)
> +    {
> +        var ret = (caps >> cap) & 1;
> +        return ret;
> +    },
> +
> +    channel_test_capability: function(cap)
> +    {
> +        return this.test_capability(this.channel_caps, cap);
> +    },

Is there any need to detect that we have not yet had a reply link, can
we be sure that these functions will never be called until after a link
is established?


Cheers,

Jeremy

> +
> +    channel_test_common_capability: function(cap)
> +    {
> +        return this.test_capability(this.common_caps, cap);
> +    }
>  }
>  
>  function spiceconn_timeout(sc)
> 

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]