Re: [PATCH v7 01/12] sound: Implements config_socket RedChannel callback

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

 



After a little more consideration, I think this should probably be
squashed into the gobject patch. I think it's fine that it was sent out
for review separately, but it probably makes more sense to have it
merged with the next commit before pushing.

Jonathon



On Mon, 2016-12-05 at 12:07 +0000, Frediano Ziglio wrote:
> This code is the same inside __new_channel but will set the
> RedsStream from RedChannel.
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  server/sound.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 45 insertions(+), 1 deletion(-)
> 
> diff --git a/server/sound.c b/server/sound.c
> index 534f23a..1f50767 100644
> --- a/server/sound.c
> +++ b/server/sound.c
> @@ -1023,7 +1023,51 @@ error1:
>  
>  static int snd_channel_config_socket(RedChannelClient *rcc)
>  {
> -    g_assert_not_reached();
> +    int delay_val;
> +    int flags;
> +#ifdef SO_PRIORITY
> +    int priority;
> +#endif
> +    int tos;
> +    RedsStream *stream = red_channel_client_get_stream(rcc);
> +    RedClient *red_client = red_channel_client_get_client(rcc);
> +    MainChannelClient *mcc = red_client_get_main(red_client);
> +
> +    if ((flags = fcntl(stream->socket, F_GETFL)) == -1) {
> +        spice_printerr("accept failed, %s", strerror(errno));
> +        return FALSE;
> +    }
> +
> +#ifdef SO_PRIORITY
> +    priority = 6;
> +    if (setsockopt(stream->socket, SOL_SOCKET, SO_PRIORITY,
> (void*)&priority,
> +                   sizeof(priority)) == -1) {
> +        if (errno != ENOTSUP) {
> +            spice_printerr("setsockopt failed, %s",
> strerror(errno));
> +        }
> +    }
> +#endif
> +
> +    tos = IPTOS_LOWDELAY;
> +    if (setsockopt(stream->socket, IPPROTO_IP, IP_TOS, (void*)&tos,
> sizeof(tos)) == -1) {
> +        if (errno != ENOTSUP) {
> +            spice_printerr("setsockopt failed, %s",
> strerror(errno));
> +        }
> +    }
> +
> +    delay_val = main_channel_client_is_low_bandwidth(mcc) ? 0 : 1;
> +    if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY,
> &delay_val, sizeof(delay_val)) == -1) {
> +        if (errno != ENOTSUP) {
> +            spice_printerr("setsockopt failed, %s",
> strerror(errno));
> +        }
> +    }
> +
> +    if (fcntl(stream->socket, F_SETFL, flags | O_NONBLOCK) == -1) {
> +        spice_printerr("accept failed, %s", strerror(errno));
> +        return FALSE;
> +    }
> +
> +    return TRUE;
>  }
>  
>  static void snd_channel_on_disconnect(RedChannelClient *rcc)
_______________________________________________
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]