[Spice-devel] [PATCH 5/7] server: don't complain if setsockopt(SO_PRIORITY) call fails

Alon Levy alevy at redhat.com
Sun Jan 22 05:37:19 PST 2012


On Thu, Jan 19, 2012 at 02:10:02PM -0600, Dan McGee wrote:
> From: Nahum Shalman <nshalman-github at elys.com>
> 
> dc7855967f4e did this for the TCP_NODELAY and IP_TOS calls; we should do
> it for priority as well if necessary.
> 
> We also #ifdef the setting of the low-level socket priority based on
> whether we have a definition of SO_PRIORITY available. This option is
> not available on Illumos/Solaris platforms; however, since we set IP_TOS
> anyway it is not a big deal to omit it here.
> ---
>  server/snd_worker.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/server/snd_worker.c b/server/snd_worker.c
> index cb64c99..e78d1d3 100644
> --- a/server/snd_worker.c
> +++ b/server/snd_worker.c
> @@ -902,7 +902,9 @@ static SndChannel *__new_channel(SndWorker *worker, int size, uint32_t channel_i
>      SndChannel *channel;
>      int delay_val;
>      int flags;
> +#ifdef SO_PRIORITY
>      int priority;
> +#endif
>      int tos;
>      MainChannelClient *mcc = red_client_get_main(client);
>  
> @@ -911,11 +913,15 @@ static SndChannel *__new_channel(SndWorker *worker, int size, uint32_t channel_i
>          goto error1;
>      }
>  
> +#ifdef SO_PRIORITY
>      priority = 6;
>      if (setsockopt(stream->socket, SOL_SOCKET, SO_PRIORITY, (void*)&priority,
>                     sizeof(priority)) == -1) {
> -        red_printf("setsockopt failed, %s", strerror(errno));
> +        if (errno != ENOTSUP) {
> +            red_printf("setsockopt failed, %s", strerror(errno));
> +        }

Not sure if this is done anywhere else (I'm thinking of the recent
patches by Daniel Berrange that added fd passing support) but it would
be nice to comment that this would fail for Solaris/Illumnos
(<=version?).

>      }
> +#endif
>  
>      tos = IPTOS_LOWDELAY;
>      if (setsockopt(stream->socket, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) == -1) {
> -- 
> 1.7.8.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list