[Spice-devel] [PATCHv2 2/3] reds-stream: add reds_stream_get_family() function

Uri Lublin uril at redhat.com
Thu Jan 15 08:51:46 PST 2015


On 01/12/2015 06:35 PM, Marc-André Lureau wrote:
> ---
>   server/reds_stream.c | 10 ++++++++++
>   server/reds_stream.h |  1 +
>   2 files changed, 11 insertions(+)
>
> diff --git a/server/reds_stream.c b/server/reds_stream.c
> index 4b61e31..e0b6f43 100644
> --- a/server/reds_stream.c
> +++ b/server/reds_stream.c
> @@ -226,6 +226,16 @@ ssize_t reds_stream_write(RedsStream *s, const void *buf, size_t nbyte)
>       return ret;
>   }
>   
> +int reds_stream_get_family(RedsStream *s)
> +{
> +    spice_return_val_if_fail(s != NULL, -1);
> +
> +    if (s->socket == -1)
> +        return -1;
> +
> +    return s->priv->info->laddr.sa_family;

Hi Marc-Andre,

Since laddr is marked as deprecated, probably better:
     return s->priv->info-> laddr_ext.ss_family;


Thanks,
     Uri.


More information about the Spice-devel mailing list