[Spice-devel] [PATCH spice-server 2/4] Do not set not blocking flag twice

Christophe Fergeau cfergeau at redhat.com
Tue Feb 14 15:11:00 UTC 2017


On Mon, Feb 13, 2017 at 11:03:17AM +0000, Frediano Ziglio wrote:
> Non blocking flag is set for all connection inside reds.c so
> there's no need to set again for the single client channel.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>

I'd move that code in a RedsStream helper while at it, I can send a
patch if you want.

Acked-by: Christophe Fergeau <cfergeau at redhat.com>

Christophe


> ---
>  server/common-graphics-channel.c | 11 -----------
>  server/sound.c                   | 11 -----------
>  2 files changed, 22 deletions(-)
> 
> diff --git a/server/common-graphics-channel.c b/server/common-graphics-channel.c
> index 29aa583..bad6e8c 100644
> --- a/server/common-graphics-channel.c
> +++ b/server/common-graphics-channel.c
> @@ -117,20 +117,9 @@ int common_channel_config_socket(RedChannelClient *rcc)
>      RedClient *client = red_channel_client_get_client(rcc);
>      MainChannelClient *mcc = red_client_get_main(client);
>      RedsStream *stream = red_channel_client_get_stream(rcc);
> -    int flags;
>      int delay_val;
>      gboolean is_low_bandwidth;
>  
> -    if ((flags = fcntl(stream->socket, F_GETFL)) == -1) {
> -        spice_warning("accept failed, %s", strerror(errno));
> -        return FALSE;
> -    }
> -
> -    if (fcntl(stream->socket, F_SETFL, flags | O_NONBLOCK) == -1) {
> -        spice_warning("accept failed, %s", strerror(errno));
> -        return FALSE;
> -    }
> -
>      // TODO - this should be dynamic, not one time at channel creation
>      is_low_bandwidth = main_channel_client_is_low_bandwidth(mcc);
>      delay_val = is_low_bandwidth ? 0 : 1;
> diff --git a/server/sound.c b/server/sound.c
> index 7c36174..3ec1f0e 100644
> --- a/server/sound.c
> +++ b/server/sound.c
> @@ -740,7 +740,6 @@ static void record_channel_send_item(RedChannelClient *rcc, G_GNUC_UNUSED RedPip
>  static int snd_channel_config_socket(RedChannelClient *rcc)
>  {
>      int delay_val;
> -    int flags;
>  #ifdef SO_PRIORITY
>      int priority;
>  #endif
> @@ -749,11 +748,6 @@ static int snd_channel_config_socket(RedChannelClient *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,
> @@ -778,11 +772,6 @@ static int snd_channel_config_socket(RedChannelClient *rcc)
>          }
>      }
>  
> -    if (fcntl(stream->socket, F_SETFL, flags | O_NONBLOCK) == -1) {
> -        spice_printerr("accept failed, %s", strerror(errno));
> -        return FALSE;
> -    }
> -
>      return TRUE;
>  }
>  
> -- 
> 2.9.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170214/caf357aa/attachment.sig>


More information about the Spice-devel mailing list